Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
Who's Online
53 user(s) are online (18 user(s) are browsing Forum)

Members: 0
Guests: 53

more...
Top Posters

Browsing this Thread:   1 Anonymous Users



(1) 2 »


Any texture coders want a challenge??
Home away from home
Joined:
2004/5/20 15:05
Group:
Registered Users
Posts: 610
Offline
In Imagine, I have been using a psuedo Ambient Ocllusion render by using a white lightdome with white objects. However this can be very slow, especially in trace mode, and is only really useful for outdoor scenes.

I was wondering if anyone out there wants to try and code a simple Ambient Occlusion texture for Imagine??

All the texture needs to do is for each pixel that hits an object with the texture applied, is to cast out random rays from the surface normal, and calculate the ratio of occluded rays vs non-occluded rays, and colour the surface accordingly (usually white objects that darken as surfaces get more occluded)

"ambient occlusion is simply a ratio of how much ambient light a surface point would be likely to receive."

There would also need to be a setting for the maximum distance that a ray will travel before being classed as non-occluded (used for indoor scenes where a skylight/lightdome would be ineffective). An option to set the number of random rays emitted from each point would also be needed.

Not sure if this would be faster or slower than my current method, but I would hope it would be faster as it could be rendered in scanline.

I would be very happy to help and test any texture if anyone is willing to give it a try, as this would give Imagine TRUE Ambient Occlusion, rather than the time consuming faked version we are forced to use now.

Here are a few links to help explain the concept a little better. Please ask if you need more info.

Ambient Occlusion
CG Education - Ambient Occlusion

Again, I am not sure if a texture of this kind is possible in Imagine, but I hope it can be done. So I hope someone is willing to take up the challenge and try

Thanks

Lahl

Posted on: 2005/9/7 23:01
Transfer the post to other applications Transfer


Re: Any texture coders want a challenge??
Webmaster
Joined:
2004/4/3 15:57
From Stockholm, Sweden.
Group:
Webmasters
Registered Users
Posts: 2455
Offline
Im not sure you can cast new rays from a texture plugin, you can affect the one thats being scanned, but I dont think you can generate several new from it, to my knowledge you dont have access to the geometry in the plugin, but the question goes on to the real shader coders that really know how to do it, is it even possible?

Posted on: 2005/9/8 8:01
_________________
Johan Andersson the Impulsive Imagineer
IFW 2.19..................
Transfer the post to other applications Transfer


Re: Any texture coders want a challenge??
Home away from home
Joined:
2004/5/20 15:05
Group:
Registered Users
Posts: 610
Offline
Quote:

webmaster wrote:
Im not sure you can cast new rays from a texture plugin, you can affect the one thats being scanned, but I dont think you can generate several new from it, to my knowledge you dont have access to the geometry in the plugin, but the question goes on to the real shader coders that really know how to do it, is it even possible?


Thats what I am unsure of, but its the key to making the texture work. I remember talk a while back about a possible dirt texture, but the problem was that the texture did not have access to data such as edge/face angles etc.

You can affect the normals and shading of a point by a texture. Many textures use this. And perhaps it would only work by raytracing and not scanline as I had hoped, since reflections work by 'seeing' other geometry in the scene, as well as transparency. Combining reflection and transparency will 'split' the ray, one being reflected, another being refracted. If rays can be split once, perhaps it can be done multiple times. *shrug*

It would be very useful if it could be done, but I am not sure. Hence posing the question in this thread.

I guess I'm just hoping .

Lahl

Posted on: 2005/9/8 8:41
Transfer the post to other applications Transfer


Re: Any texture coders want a challenge??
Webmaster
Joined:
2004/4/3 15:57
From Stockholm, Sweden.
Group:
Webmasters
Registered Users
Posts: 2455
Offline
Quote:

Lahl wrote:

You can affect the normals and shading of a point by a texture. Many textures use this. And perhaps it would only work by raytracing and not scanline as I had hoped, since reflections work by 'seeing' other geometry in the scene, as well as transparency. Combining reflection and transparency will 'split' the ray, one being reflected, another being refracted. If rays can be split once, perhaps it can be done multiple times. *shrug*


Yes, you can spawn new rays from a texture, maybe that can be used as you say, But I am unsure how, since the new ray would be run through the same cycle :-/ it could easealy be very computeintensive without really knowing what to calculate :-/

Hello all shaderbuilders, what do you think, possible or not?

Posted on: 2005/9/8 15:39
_________________
Johan Andersson the Impulsive Imagineer
IFW 2.19..................
Transfer the post to other applications Transfer


Re: Any texture coders want a challenge??
Home away from home
Joined:
2004/5/20 15:05
Group:
Registered Users
Posts: 610
Offline
Quote:

webmaster wrote:
it could easealy be very computeintensive without really knowing what to calculate :-/

True. If it were possible, it would be almost a stochastic raytracing method. And if its not done correctly or if too many rays are used, then it could take a very long time to render.

However it is simplified by not needing to calculate colour, reflections, refraction, specular or anything else. just calculate the ratio of occuded/unoccluded rays, and then assign the corresponding percentage of colour

Unfortunately I doubt any sort of optimisation method could be used to cache rays and average/smooth the result from low level raycasting etc.

But even so, surely it has to be faster than raytracing hundreds or thousands of lights, normal or softshadow. That takes forever, and Imagine's octree problems slow things down too, which a simple texture shouldn't have a problem with.

Also, calculating lights into the equation won't be necessary at all, as there really shouldn't be any lights needed at all..... all objects could be set to full brightness, and the raycasting AO texture would provide all the shading.

I guess to me it seems so very simple, as long as Imagine will allow the texture to cast more rays. Thats the sticking point really as I see it (but then again I'm not a programmer hehe)

Here's hoping

Lahl

Posted on: 2005/9/8 17:33
Transfer the post to other applications Transfer


Re: Any texture coders want a challenge??
Webmaster
Joined:
2004/4/3 15:57
From Stockholm, Sweden.
Group:
Webmasters
Registered Users
Posts: 2455
Offline
Quote:

Lahl wrote:

I guess to me it seems so very simple, as long as Imagine will allow the texture to cast more rays. Thats the sticking point really as I see it (but then again I'm not a programmer hehe)

Here's hoping

Lahl


It is simple, the method behind almost all rendering is dead simple
and in this case very easy, but as you say, it all comes down to what Imagine can do in this respect, I dont have the sourcecode (yet) so I cant even check

Maybe we could get Raymond to check or see if we could get any of the normal texture coders to voice in, maybe we need to air it on the IML to get their attention?

Posted on: 2005/9/9 6:17
_________________
Johan Andersson the Impulsive Imagineer
IFW 2.19..................
Transfer the post to other applications Transfer


Re: Any texture coders want a challenge??
Just popping in
Joined:
2004/6/5 8:49
Group:
Registered Users
Posts: 11
Offline
Sorry, currently to can't cast rays from a shader. This means that you can't do ambient occlusion using this method. Also, this method would most likely, be very much slower as you need 32/64/128 additional rays for each hit to produce a noise free render.

I did talk about building this into the texture SDK along with the ability for obtaining the light infomation. It would take about an hour to write a A.Occ shader if there was a function to cast a ray back into a scene and see if it hit anything. It doesn't even have to ray trace just return the length to what it hit or -1 if it hit nothing and you could also have a nice dust shader to. If you would like to see my LW Ambient Occlusion shader check out:

http://www.shaders.org/ifw2_textures/gallery/boxxbot.jpg
http://www.shaders.org/ifw2_textures/gallery/dragon.jpg
http://www.shaders.org/ifw2_textures/gallery/budha.jpg

RJJ

Posted on: 2005/9/9 12:17
Transfer the post to other applications Transfer


Re: Any texture coders want a challenge??
Home away from home
Joined:
2004/5/20 15:05
Group:
Registered Users
Posts: 610
Offline
Quote:

shadersrjj wrote:
Sorry, currently to can't cast rays from a shader. This means that you can't do ambient occlusion using this method. Also, this method would most likely, be very much slower as you need 32/64/128 additional rays for each hit to produce a noise free render.


Damn. That really sucks. Was hopeful there for a minute.

Not sure if it would have been slower, even with 128 or more additional rays per pixel, compared to rendering 250, 500 or 1000 or more shadowcasting lights to 'fake it'

Quote:
It would take about an hour to write a A.Occ shader if there was a function to cast a ray back into a scene and see if it hit anything. It doesn't even have to ray trace just return the length to what it hit or -1 if it hit nothing


So, if it had the functionality necessary, you could write an AO texture that would work in scanline?? would be even faster then.

Love the LW AO shader. how fast is it to render??

Quote:
I did talk about building this into the texture SDK along with the ability for obtaining the light infomation.

what would this involve? Drastic changes? or just a simple addition? I guess if it was included then it would only be usable in the CUP3 versions anyway. Was hoping to have something generic that most people could easily use.

Oh well.... scratch that idea *shrug*

thanks for the info

Lahl

Posted on: 2005/9/9 12:50
Transfer the post to other applications Transfer


Re: Any texture coders want a challenge??
Home away from home
Joined:
2004/5/20 15:05
Group:
Registered Users
Posts: 610
Offline
Here's another thought.....

If Imagine cannot spawn new rays from the texture, then how about re-using the rays it does generate?

What if you raytraced the image with a resolve depth of 1, the texture could cast its initial ray along the face normal as usual, then instead of spawning new rays, just loop this process a specified # of times, each time varying the normal to eventually create that hemispherical ray pattern.

eg.
cast ray along surface normal as usual
Store result
alter normal
loop
cast ray again along new normal
Store result
alter normal again
loop
cast ray again along new normal
Store result
alter normal again
loop
cast ray again along new normal
Store result
alter normal again
loop
.
.
.
.
end loop when specified # of rays have been cast
reset normal
calculate AO ratio and shading from the stored results
End loop and proceed to the next pixel to be rendered
Repeat


Again, this is just my ideas for possible flow of the process.... no idea if it could work at all

Does it sound possible?

Unfortunately this probably would take a long time to render, possible as long as or longer than the 'faked method', but I guess I want REAL Ambient Occlusion, as its an invaluable feature and it is needed to do indoor scenes properly.

Guess I'm just hopeful that even if the 'simple' method I thought would work isn't possible, then parhaps it could still be achieved with a bit more effort and complexity.

Hey, I'm a perfectionist, what do you expect

Lahl

Posted on: 2005/9/10 2:36
Transfer the post to other applications Transfer


Re: Any texture coders want a challenge??
Home away from home
Joined:
2004/4/12 5:20
From Perth,Australia
Group:
Registered Users
Posts: 525
Offline
not entirely sure what you mean but couldn't small ,more focused light arrays help out in indoor scenes.refine the brute force method if thats all thats available.

Posted on: 2005/9/10 10:35
_________________
Imagine 2.19 ......
Transfer the post to other applications Transfer



(1) 2 »



You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.

[Advanced Search]


Search
Powered by XOOPS © 2001-2009 The XOOPS Project