Possible to "fix" render-to-texture shadows?

Grab your favourite IDE and tinker with the innards of game engines

Re: Possible to "fix" render-to-texture shadows?

Postby Smurftyours on Mon May 31, 2010 11:00 pm

-=Biohazard=- wrote:You can draw the scene another time in an orthogonally projected view and compare distance values when drawing the normal view to create a projected shadow for the whole scene and replace the stencil shadows.

I'm still in need of blurring the shadow, probably with a noise texture in the per object shaders, and the (mounted) trees in the following screen are messed up because they need to be compiled as two-pass to look right. Sadly it seems that the shadow resolution can't be higher than the framebuffers', because the RT needs a depthbuffer, so without blurring it's extremely pixelated, but at least everything casts a shadow on anything now:

pic 1, pic 2, pic 3

So with some tweaking this might turn out okay later...


You have to finish the shadowing shader and fix the pixelation. If you were to release the shader code I think everyone in the source modding department would be very thankful. What are the hits on performance though? And is There a DOF shader in there as well?
jangalomph wrote:Wise words from a wise man. ^
User avatar
Smurftyours
Senior Member
Senior Member
 
Joined: Tue Aug 04, 2009 6:11 pm
Location: California, US.

Re: Possible to "fix" render-to-texture shadows?

Postby coder0xff on Tue Jun 01, 2010 6:18 am

Why are you rendering them orthogonal? That's great if all you want is parallel light (like sun) and it's a good optimization for such cases... but for more general use it should be possible to do perspective projections.
User avatar
coder0xff
Veteran
Veteran
 
Joined: Fri Jun 13, 2008 1:51 am

Re: Possible to "fix" render-to-texture shadows?

Postby -=Biohazard=- on Tue Jun 01, 2010 4:18 pm

coder0xff wrote:Why are you rendering them orthogonal? That's great if all you want is parallel light (like sun) and it's a good optimization for such cases... but for more general use it should be possible to do perspective projections.


Well my goal was to create a shadow that behaves relative to the sun entity, I could change them to support perspective shadows, but that would only be interesting if I was to create omnidirectional lights. I'm also drawing the shadow now as a part of the standard pass, using multiple shadows would either require a new pass for each shadow or, which is way better, a PP pass that calcs the worldpos of stuff based on the depth. Even if I should figure out how to create a RT cubemap (is that possible at all?) the performance cost would be immense.

Smurftyours wrote:You have to finish the shadowing shader and fix the pixelation. If you were to release the shader code I think everyone in the source modding department would be very thankful. What are the hits on performance though? And is There a DOF shader in there as well?


I made a first attempt of counteracting the pixelation, but I probably have to tweak that further, not sure what else I can do besides noise w/o adding even more lookups.

The performance hit totally depends on the complexity of the scene it seems, while it costs about half as much as the flashlight in a simple scene (sdk_vehicles), it will run a bit slower in a complex scene with lots of translucent objects for example (ep2_outland_10 or something). Atm I'm creating a shadow in a 2048² area in front of the player, reducing that size will heavily increase performance and also improve the resolution per pixel. For a FPS this area is probably way too big for example.

Yes there's also a dof shader, but a very simple one (notice the bleeding), I can't afford anyhting costly besides all the other post processing stuff :? .
User avatar
-=Biohazard=-
Regular
Regular
 
Joined: Mon Apr 07, 2008 11:15 am

Re: Possible to "fix" render-to-texture shadows?

Postby Smurftyours on Tue Jun 01, 2010 7:07 pm

What kind of rig are you running? You basically have so many post processing effects being render that it doesn't even look like source anymore, which is a good thing!
jangalomph wrote:Wise words from a wise man. ^
User avatar
Smurftyours
Senior Member
Senior Member
 
Joined: Tue Aug 04, 2009 6:11 pm
Location: California, US.

Re: Possible to "fix" render-to-texture shadows?

Postby Bites on Tue Nov 16, 2010 1:36 am

Sorry to bump such an old topic, but this is very interesting for my intentions. Would you care to share the code you used to do this?
Bites
Dumpling
Dumpling
 
Joined: Thu Aug 19, 2010 8:32 am

Re: Possible to "fix" render-to-texture shadows?

Postby Gary on Tue Nov 16, 2010 7:52 am

I would also like to try this out, but last time I asked, he was busy. Hopefully he can release so people can learn and benefit from it.
Have a question related to modding or something I posted? Something that needs staff attention? I haven't been active lately, but feel free to PM me or message me on Steam(link below)

User avatar
Gary
Interlopers Staff
Interlopers Staff
 
Joined: Wed Dec 16, 2009 12:40 am
Location: USA, FL
Previous

Return to Programming

Who is online

Users browsing this forum: No registered users