Page 1 of 1

Making a shader receive shadows but not cast them

Posted: Sat Jan 10, 2015 3:22 am
by Captaintoottoot
Suppose you have a light and a brush blocking the light for another brush. I'm looking to get shadows on the blocker, but I don't want the blocker to cast a shadow on the brush behind it. Isn't there a shader command to do this? Otherwise I think the only other way is to make it a group, or a model and set _rs 1 and _cs 0, but there's got to be a better way of doing this through the shader.

Re: Making a shader receive shadows but not cast them

Posted: Sat Jan 10, 2015 6:48 am
by Theftbot
Try making the brushes in consideration a func_static, set entity keys:

_cs 0
_rs 1

Re: Making a shader receive shadows but not cast them

Posted: Sat Jan 10, 2015 9:26 am
by AEon
Once that works would be nice to see an image of that application.

Re: Making a shader receive shadows but not cast them

Posted: Sat Jan 10, 2015 11:29 am
by Hipshot
Never seen a shaderparm like that, but I've used _rs and _cs many times for what you are describing.

Re: Making a shader receive shadows but not cast them

Posted: Sat Jan 10, 2015 7:10 pm
by sst13
"surfaceparm trans"? ...works fine for me. :D

By the way, _rs & _cs are completely new for me. Is there a list (updated entities.def?) with all the "new" entity keys?

like:
_mingridlight
_minvertexlight
_blocksize
vertexremapshader1
_lightmapscale
modelscale
...

Re: Making a shader receive shadows but not cast them

Posted: Sat Jan 10, 2015 7:28 pm
by AEon
GTKradiant 1.6.4, select a brush, hit N, bingo:

Only used for the world.
-------- KEYS --------
message : Text to print at user logon. Used for name of level.
music : Path/name of looping .wav file used for level's music (e.g. music/sonic5.wav).
_ambient OR ambient : Adds a constant value to overall lighting. Use is not recommended. Ambient light will have a tendency to flatten out variations in light and shade.
_color : RGB value for ambient light color (default 0 0 0).
gravity : Gravity of level (default 800 = normal gravity).
gridsize : Granularity of the lightgrid created by q3map. Value is three integers separated by spaces, representing number of units between grid points in X Y Z. Default gridsize value is 128 128 256. Use larger powers of 2 to reduce BSP size and compile time on very large maps.
_blocksize : Q3Map always splits the BSP tree along the planes X=_blocksize*n and Y=_blocksize*n. Increase the blocksize using larger powers of 2 to reduce compile times on very large maps with a low structural brush density (default 1024 1024 0, 0 values = disable).

-------- Q3MAP2 KEYS --------
_minlight : Minimum light value, levelwide. Uses the _color key to set color. Does not add, unlike ambient.
_minvertexlight : Minimum vertex lighting, levelwide.
_mingridlight : Minimum lightgrid (dynamic entity lighting) levelwide.
_keeplights : Keep light entities in the BSP. Normally stripped out by the BSP process and read from the .map file by the lighting phase.
_noshadersun : Ignore q3map_sun/sun directives in sky shaders and ONLY use entity sun lights.
_farplanedist : Limit on how many units the vis phase of compilation can see. Used in combination with level-wide fog, it can help reduce r_speeds on large, open maps.
_foghull : Shader to use for "fog hull". Foghull shader should be a sky shader. Omit the "textures/" prefix.
_lightmapscale : Floating point value scales the resolution of lightmaps on brushes/patches in the world. Can be overridden in func_group (or other entities) (default 1.0).
_cs OR _castshadows : Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
_rs OR _receiveshadows : Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
_celshader : Sets the cel shader used for this geometry. Note: Omit the "textures/" prefix. Overridable in entities.
_styleNalphaGen : *IMPORTANT* Replace "N" in the key "_styleNalphaGen" with an integer between 1 and 31 as your style index. Values takes standard shader waveform functions (e.g. wave sin 0.5 0.3 0.25 1.5)
_styleNrgbGen : *IMPORTANT* Replace "N" in the key "_styleNrgbGen" with an integer between 1 and 31 as your style index. Values take standard shader waveform functions (e.g. wave sin 0.5 0.3 0.25 1.5)

-------- Q3MAP2 TERRAIN KEYS --------
_indexmap OR alphamap : Path/name for the art file used to guide the mapping of textures on the terrain surface.
_layers OR layers : Integer value denotes number of unique root shaders that will be used on the terrain.
_shader OR shader : Path to the metashader used to assign textures to the terrain entity. Note: Omit the "textures/" prefix.

Re: Making a shader receive shadows but not cast them

Posted: Sat Jan 10, 2015 9:56 pm
by Hipshot
sst13 wrote:"surfaceparm trans"? ...works fine for me. :D
Trans tells a material to be "shine through" it doesn't allow for anything more than that. With cs and rs, you can tell what object casts shadows on and/or receives light from what.

Re: Making a shader receive shadows but not cast them

Posted: Sun Jan 11, 2015 12:40 am
by obsidian
Or rather, trans sets the brush to be ignored by -vis and does not try to cull objects behind it.

Re: Making a shader receive shadows but not cast them

Posted: Sun Jan 11, 2015 12:45 am
by obsidian
As for entity definition files, there's a pretty large list of stuff that I've added/cleaned up for GtkRadiant. Most of it is for Q3Map2, Q3A Point Release 1.32, and QuakeLive. It's included with the latest version of GtkRadiant.