Dynamic Shadowing and Lighting - Using env_projectedtexture

Reveal what you have made so far and get feedback on development.

Dynamic Shadowing and Lighting - Using env_projectedtexture

Postby Gary on Fri Feb 18, 2011 5:57 am

I am working on a tutorial for using the env_projectedtexture entity, I have wrote a little so far, there is still tons more work to be done, but I want to know what you guys think of it so far and any suggestions for stuff to be added. Feel free to point out spelling and/or grammar errors.

To be added:
Images
Example tutorial to give people a little experience in entity use.
More info on the entity's variables.
Add links to VDC fixes.
Download containing modified CPP/h. files, compiled binaries and example maps.
Some other stuff.

-----------------------------------------Tutorial So Far---------------------------------------

Dynamic Shadowing and Lighting

Using env_projectedtexture



Information about the entity


<Cool image or two here demonstrating>

Unlike most light entities which lighting and shadowing are calculated during map compiling(VRAD) with a few exceptions(point_spotlight), env_projectedtexture's lighting and shadows are calculated completely in real time and at a per-pixel level. Projectedtexture's use a different method for lighting, which takes the light's point of view and figures that anything the light can't see is in shadow then loads this info into a depth render target(texture). This is a commonly used method called shadow-mapping.

This has some advantages and disadvantages, which I will now go over;

Advantages:
. Lights areas dynamically.
. Allows objects to cast shadows on other objects and them selves.
. Can be parented(after proper code fixes)
. Add depth and complexity to scenes.
. Can "project" a VTF onto a scene.
. Can change the color, shadows, fov, VTF and cast distance dynamically through the entity I/O system.


Disadvantages:
. Objects farther from the light cast shadows with less definition.(Texture resolution limitation)
. Can't be used for large areas, due to the problem above.
. Expensive; having to grab the depth and load it back onto the scene every frame takes slows the whole process.
. Not backwards compatible with older machines.



Okay, now onto the tutorial part, lets learn how to use this thing and where it should be used.

Proper Usage


You must be very careful with this entity, it's not a replacement for every light entity in your map(In fact it won't work as the only light entity in a map and will cause it to be fullbright).

Valve used it for the flashlight and EP2 GMan scenes, something these uses have in common is that the light is extremely close to the caster/receivers. With out the recent code additions from the community, we are limited to only those kinds of usage. With these code additions, we can extend the range to light an entire reasonably sized room. Though without much more drastic changes, we can't light huge areas such as warehouses or outdoor scenes.


Currently(Src07), the Hammer support for this entity is quite little. You can't easily rotate the entity in the viewports and it is missing a keyvalue and input. The code support is also poor. Some information taken from the VDC, credit to relevant authors.



Ideal for this scene(FOV:30, Filter:1, Near-z: 350)
Image

Low near-z(FOV:30, Filter:1, Near-z: 5)
Image

No Filter(FOV:30, Filter:0, Near-z: 350)
Image

High(default Src2007) Filter(FOV:30, Filter:3, Near-z: 350)
Image

High FOV(FOV:60, Filter:1, Near-z: 350)
Image

Per-pixel effect(FOV:100, Shadows: OFF)
Image

ShadowAtten Fading(note the really black part of the shadow near camera)
Missing

Lighting/shadowing fades on brushes not model(note how the airboats are lit but the ground is not)
Image
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: Dynamic Shadowing and Lighting - Using env_projectedtext

Postby Smurftyours on Fri Feb 18, 2011 6:30 pm

Looking good so far.
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: Dynamic Shadowing and Lighting - Using env_projectedtext

Postby MayheM on Fri Feb 18, 2011 6:59 pm

Ok stupid question... I have a theater in my house map, am I correct that this will allow me to project something on a screen that will be blocked when a player steps in from of it? Because that is the one things I do not like about the current setup. Right now, it is visible even when someone stands right in front of it. It is unrealistic to say he least...
Image
User avatar
MayheM
Veteran
Veteran
 
Joined: Tue Oct 16, 2007 7:46 pm
Location: Lancaster SC

Re: Dynamic Shadowing and Lighting - Using env_projectedtext

Postby Gary on Fri Feb 18, 2011 7:12 pm

Isn't your map for CSS? I am not sure about the projectedtexture support for it.

Anyways, yes, players would block the projection. Though, this projects vtf files, not vmt files, so I'm not sure about animated screens(would have to look into that for you when I get home).
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: Dynamic Shadowing and Lighting - Using env_projectedtext

Postby MayheM on Fri Feb 18, 2011 7:19 pm

CS:S now using Ep2 so if it is in EP2 as you said, It should be in CS:S...

As for the animated texture, it is actually just scrolling credits of the movie. This is my way of putting the credits in the movie. So as long as it works with a scrolling texture, it should work just fine.
Image
User avatar
MayheM
Veteran
Veteran
 
Joined: Tue Oct 16, 2007 7:46 pm
Location: Lancaster SC

Re: Dynamic Shadowing and Lighting - Using env_projectedtext

Postby Gary on Mon Feb 21, 2011 9:37 pm

Sorry for the inactivity, been busy and had to post from my phone.

Mayhem, did you get it to work? Also, I don't think you can make a vtf scroll without a vmt.

Though, not really clean, you could make multiple textures that have the text at different heights, then use the I/O system to set the projectedtexture to each texture after a certain amount of time. How smooth the text would appear to scroll depends on how much time you give each "frame" and the total amount of "frames".
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: Dynamic Shadowing and Lighting - Using env_projectedtext

Postby dark0r on Tue Feb 22, 2011 12:51 am

@MayheM: Just a heads up, local players won't block the light projection, but other players would.
dark0r
Been Here A While
Been Here A While
 
Joined: Sat Mar 25, 2006 10:16 am
Location: de_hell

Re: Dynamic Shadowing and Lighting - Using env_projectedtext

Postby darkpivot on Tue Feb 22, 2011 2:21 am

Ooh, nice tutorial so far, nice work Gary. I'd like to supply some of the screenshots. Do you think I could do that?
User avatar
darkpivot
Pheropod
Pheropod
 
Joined: Sun Oct 03, 2010 12:49 am

Re: Dynamic Shadowing and Lighting - Using env_projectedtext

Postby Gary on Tue Feb 22, 2011 3:05 am

I had most of them planned out, we can talk about it tomorrow over steam.
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

Return to Under Construction

Who is online

Users browsing this forum: No registered users