Real time shader ray tracing (Kinda)

Return to Showcase

Real time shader ray tracing (Kinda)

Postby Craig » Wed Sep 02, 2009 11:24 pm

Image

Here is a rendering of the 0 crossing of a density field procedurally generated in a shader on a full screen quad. It projects rays out into the density field, and tries to find the surface (and often fails). The density field equation has derivative data for lighting, and I reflect rays as they cross a r=1 sphere. Currently no rays are traced for shadows, though it should not be hard to add.

As the camera moves, the edges tend to jitter quite a bit. With some low rez surface finding passes, and some edge detection and higher rez passes, this could be fixed, and probably sped up slightly.

It is not a serious attempt at a rendering system for a game. It has major issues. It probably could be made to work well enough for some real use, and it could be fed the depth buffer so it could not overlay on everything. Ambient occlusion could be added, and so could shadows, refraction, and some other cool effects, but doing all of this would most likely make it even slower, and it has nasty artifacts, and interacts with pre made models horribly as it is only created as needed in the shader. Currently I am unable to get decent noise into it until I can get the proper derivatives of 3D noise functions. It could be made to work with height maps, and add detail noise that can include overhangs and caves. Currently it just takes a pile on sin functions and adds them up.

I will continue to play with it, and if I get anything more interesting, I'll post it here. Basically everything (other than making the full screen quad and passing in the camera position) is in the fragment shader. The source is here http://spincraftsoftware.wikidot.com/local--files/miscfiles/ScreenDensityPlanet.zip incase anyone wants to look at it.
Craig
 
Posts: 330
Joined: Thu Jul 02, 2009 8:55 pm

Postby rdb » Thu Sep 03, 2009 12:07 pm

Very nicely done!
rdb
 
Posts: 9592
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby Craig » Thu Sep 03, 2009 9:15 pm

pro-rsoft wrote:Very nicely done!


Thanks.
Craig
 
Posts: 330
Joined: Thu Jul 02, 2009 8:55 pm


Return to Showcase

Who is online

Users browsing this forum: No registered users and 0 guests