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

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

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

Postby Gary on Thu Feb 25, 2010 7:55 pm

Okay, I have finily decided that the dynamic shadow projecting light entities(env_projectedtexture) are a lost cause for large-scale use. So I started to look at the shadows almost every prop casts, the render-to-texture shadows.

This is a render-to-texture shadow, you will notice these on just about every prop/npc.
Image

Now, as they are now render-to-texture shadows have a few problems.
*No self Shadowing
*Only brushes can receive them.
*There can only be one shadow control entity.

So I was wondering, can any of these problems be solved? Can we even modify the code for these shadows?
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

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

Postby coder0xff on Mon Apr 05, 2010 4:40 am

I haven't been able to look too closely at that part of the rendering code yet, but stenciled shadows CAN self shadow, but the shader has to support it. You can probably do more than one shadow control entity, but you have to either A: come up with a way to choose which one is active, or B: Do a geometry pass per shadow entity and modify the shaders to use more than one one stencil texture.
User avatar
coder0xff
Veteran
Veteran
 
Joined: Fri Jun 13, 2008 1:51 am

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

Postby Gary on Mon Apr 05, 2010 9:54 am

Much thanks for replying and for the suggestions. I will have to look into making this work. Also, you said they can self shadow, so, I am guessing they could also cast shadows on models?
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

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

Postby coder0xff on Sun Apr 11, 2010 12:43 am

Gary wrote:Much thanks for replying and for the suggestions. I will have to look into making this work. Also, you said they can self shadow, so, I am guessing they could also cast shadows on models?


Should, yeah
User avatar
coder0xff
Veteran
Veteran
 
Joined: Fri Jun 13, 2008 1:51 am

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

Postby Gary on Sun Apr 11, 2010 12:59 am

Thanks, they still won't be as good as dynamic shadows, but they will be the next best thing.
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

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

Postby JLea on Sun Apr 11, 2010 3:35 am

I once tried fixing these in a different method. I tried finding a light entity in a sphere around the entity, and modifying the shadow being cast to the direction of the light. Gave up halfway because the math was killing me.
User avatar
JLea
May Contain Skills
May Contain Skills
 
Joined: Mon Jan 02, 2006 1:19 pm
Location: Melbourne, Australia

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

Postby pfannkuchen_gesicht on Sat May 29, 2010 11:59 pm

what about creating a env_projectedtexture for each dynamic object in a specific radius with the direction of the sun.(+a max shadows convar)
pfannkuchen_gesicht
Member
Member
 
Joined: Sat May 29, 2010 11:36 pm

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

Postby Gary on Sun May 30, 2010 12:19 am

pfannkuchen_gesicht wrote:what about creating a env_projectedtexture for each dynamic object in a specific radius with the direction of the sun.(+a max shadows convar)


Wouldn't be a very practical solution. I would assume massive performance drops.
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

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

Postby pfannkuchen_gesicht on Sun May 30, 2010 10:34 am

yeah, probably.
you could have about 10 max.
pfannkuchen_gesicht
Member
Member
 
Joined: Sat May 29, 2010 11:36 pm

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

Postby PhoeniX1992 on Sun May 30, 2010 1:24 pm

an invisible shadow casting func_illusionary or physbox parented to the ship?
User avatar
PhoeniX1992
1337 p0st3r
1337 p0st3r
 
Joined: Sat Jun 24, 2006 7:46 pm
Location: Office Chair

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

Postby -=Biohazard=- on Sun May 30, 2010 2:56 pm

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...
User avatar
-=Biohazard=-
Regular
Regular
 
Joined: Mon Apr 07, 2008 11:15 am

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

Postby Surfa on Sun May 30, 2010 3:04 pm

That is pretty damn awesome.
Surfa
May Contain Skills
May Contain Skills
 
Joined: Sun Dec 30, 2007 3:04 pm

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

Postby Gary on Sun May 30, 2010 3:35 pm

PhoeniX1992 wrote:an invisible shadow casting func_illusionary or physbox parented to the ship?


That would just cast an RTT shadow, I am asking how to make the RTT shadow cast self shadows and shadows on other models.

Whoa, Biohazard, you made the RTT shadows do that? I'm pretty amazed. Now, the last problem with RTT is the fact that it's orientation is irrelevant to lights. Maybe we could have the entites detect where the nearest light source is and point it's shadow in the opposite direction.

Really, I think a idea would be to use both Render-To-Texture shadows and shadow-mapped ones. Use RTT ones all the time and shadow-mapped ones when you need some really nice lighting.
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

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

Postby MáØ on Sun May 30, 2010 5:30 pm

Just wanted to say biohazard, that shader (I'm guessing it's a custom shader at least.) is awesome looking.
User avatar
MáØ
Pheropod
Pheropod
 
Joined: Fri May 22, 2009 5:14 pm
Location: BC, Canada

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

Postby -=Biohazard=- on Mon May 31, 2010 2:57 pm

Surfa wrote:That is pretty damn awesome.
MáØ wrote:Just wanted to say biohazard, that shader (I'm guessing it's a custom shader at least.) is awesome looking.

Thanks a lot, and yes, all of those shaders are custom (or at least customized).

Valves RTT shadows are disabled though, i guess this technique is very similar to the projected textures, just that it doesn't cast light and instead darkens the scene. Atm it's relative to the latest env_sun created like the godrays. Indoors you can't see any of that Shadow, but ssao is sufficient then i think.
User avatar
-=Biohazard=-
Regular
Regular
 
Joined: Mon Apr 07, 2008 11:15 am
Next

Return to Programming

Who is online

Users browsing this forum: No registered users