Terrain Shadows - is it possible?

Posted By: Vonman

Terrain Shadows - is it possible? - 08/29/06 05:23

Hi, I just recently bought gsA6 pro and am eperimenting with terrains. I have learned that terrains cast nice shadows when lit by a dynamic light, BUT... If the terrain is lit at all by a static light (placed with WED) the light will illuminate the ENTIRE terrain and the terrain will not have any shadows or radiance whatsoever. I've tryed playing around with sun angles, ambiance, albedo, ect, and cannot figure this out. If it's not possible, then I want half off the origanal price for an upgrade to the future A7 or whatever future version that will do this lol!!
Posted By: ulillillia

Re: Terrain Shadows - is it possible? - 08/29/06 07:03

Only blocks are affected by static lights. For other types of entities (sprites, terrains, models, etc.), you'd need dynamic lights to light them. Shadows also affect it (yes, entities can cast shadows on each other).
Posted By: Machinery_Frank

Re: Terrain Shadows - is it possible? - 08/29/06 07:44

You can have shadows on terrain. A simple way is a material with a very low diffuse and ambient value.

The most powerful way is the shader that you can find in the template folder. This shader can paint several layers of tileable textures and one layer of shadows over each other. With this you can paint your shadows or you can bake the shadow in an external software (like FreeWorld3d). So every tree could cast a shadow. But this would be a static solution.
Posted By: Vonman

Re: Terrain Shadows - is it possible? - 08/29/06 09:25

In a previous version (A4 or A5 I think standard edition) the static lights DID make moving entities have shadows, I just don't understand why it wont with A6.
Posted By: Machinery_Frank

Re: Terrain Shadows - is it possible? - 08/29/06 11:36

Only sunlight makes dynamic shadows on blocks models or terrain. Static light cannot do it. It can only color textures and change colors of models standing on blocks with a certain lightmap.
Posted By: ulillillia

Re: Terrain Shadows - is it possible? - 08/29/06 12:13

Quote:

Only sunlight makes dynamic shadows on blocks models or terrain. Static light cannot do it. It can only color textures and change colors of models standing on blocks with a certain lightmap.




Correction: "Only dynamic lights...". The Sun is considered as a dynamic light as well. I'm not all that familiar with lights, so I may be wrong.
Posted By: Damocles

Re: Terrain Shadows - is it possible? - 08/29/06 13:06

This is a baked shadow onto the terrainbitmap:
(but it is static and can not change to different sunpositions)




With the multitexturing shader in the templates, you can
also mix this with different textures in the terrain.

There is currently no option in Wed to bake shadows onto a terrain.
Posted By: Vonman

Re: Terrain Shadows - is it possible? - 08/29/06 14:33

I used to have A5 standard and static lights used to be able to create a gouraud on models, now, A6 does'nt... that totaly sucks! lol
Posted By: Damocles

Re: Terrain Shadows - is it possible? - 08/29/06 15:28

So you are no really talking about shadows, but albedo on terrains:

A5 standard did not have Terrains,

and Models are still affected by albedo and the brightness of
the underlying BSP Block.
For a finer look, read the manual about the materials.
Posted By: Vonman

Re: Terrain Shadows - is it possible? - 08/29/06 16:37

What I was talking about is the gouraud on models and terrains. If I use the sunlight or static lights in A6, it iluminates the entire model or terrain like a cartoon with no gouraud. It lites the entire thing up evenly on all sides, even the sides that are'nt facing the light source.
Posted By: JibbSmart

Re: Terrain Shadows - is it possible? - 08/30/06 10:07

if it has an action, make a material in the code and put in the action "my.material = theMaterialVonmanMade;"

or you can go to MED and edit its material properties there. search through the manual for "materials". also, i think some variable has to be set to make the sun be treated as a dynamic light.

julz
Posted By: Damocles

Re: Terrain Shadows - is it possible? - 08/30/06 10:52

Here is a little Modelviewer,
just insert your terrain into it at the position
string das_model=<marine_cosh.mdl>;

You might just scale it in cas it is to big.

This way you can test how the material settings affect the terrain.

http://www.coniserver.net/ubbthreads/showflat.php/Cat/0/Number/684932/an/0/page/0#Post684932
Posted By: sheefo

Re: Terrain Shadows - is it possible? - 08/30/06 12:32

If you want shadows on terrain just set an entity to have a stencil shadow. Then a dynamic shadow will be displayed on a terrain.
Posted By: Shaque

Re: Terrain Shadows - is it possible? - 09/01/06 04:22

I'm not an expert, but did you export your terrain from MED? If so did you alter the ambience? I did the same this and my entire terrain is too lit up and looks cartoony, until I realised that you can adjust how much the light affects the terrain in MED (A6 as far as I know). Now my terrain has low ambience and is only lit based on the intensity and distance of lights (dynamic or static) and sunlight. I hope this helps.
Posted By: Vonman

Re: Terrain Shadows - is it possible? - 09/01/06 07:45

No, I just made the terrain, added a skin and saved it. I did'nt know that changing the ambiance in MED would make a difference, i'll try that!!! :-D THX!
Posted By: Vonman

Re: Terrain Shadows - is it possible? - 09/01/06 08:10

WOW! It DID work! Thanks for the Tip! My project is gonna have some MEAN graphics when i'm done with it :-D
Posted By: Shaque

Re: Terrain Shadows - is it possible? - 09/01/06 15:12

It's my first day in this forum and I love to stick my nose in everything that has not yet been responded to, if I think that I may have a solution of course, because I had the same problem, but I'm sure you would have figured it out eventually as I did. I'm just a newbie, but I'm glad I could help.
Posted By: broozar

Re: Terrain Shadows - is it possible? - 09/02/06 17:03

hi, i am cureently trying to get the wiki example
http://www.coniserver.net/wiki/index.php/Terrain_Shadowmapping
to work, but i have no success. i simply get a plain grey map. i'd be grateful if someone could post an example/a step-by-strep guide. thanks in advance.

ahm, damocles: i need exactly what you have, a shadow baker for all objects... any chance you could share it?
Posted By: Grafton

Re: Terrain Shadows - is it possible? - 09/02/06 19:32

DaBro0zar, you might want to check out the shadow map creation utility I uploaded at Acknex resource site Here, sounds like it might be what you need.
Posted By: Shaque

Re: Terrain Shadows - is it possible? - 09/03/06 06:53

Well, I have not yet tried this, but how about you choose the angle of your sunlight over the terrain you created and leave the terrain a flat grey or white. Then switch the camera view from above and export the shadow.

It's just a thought...
Posted By: broozar

Re: Terrain Shadows - is it possible? - 09/03/06 16:55

thanks a lot josiah.
is there a way to bake model shadows as well? as you can see here,



map ents and blocks are rendered fine, but models aren't. why? i cannot see an ignore_models-line in your trace. this is strange. please help me.
Posted By: broozar

Re: Terrain Shadows - is it possible? - 09/03/06 17:29

for simple shapes, like this snowy pine tree, i may rebuild it with inv. blocks



but this is not nice for a whole forest nor for more complex shapes.
Posted By: Grafton

Re: Terrain Shadows - is it possible? - 09/03/06 19:27

You will need to set "polygon = on;" for models either by script or in WEDs
properties for the model, or else the bounding box will be rendered and not the
model! And if you forget to do this and then scale your model, the shadow of the
bounding box will be a small dot, since it dosent scale with the model.

Shadows of models with fine lines may be blurred out, so you may want to blur
them by hand in an image editing program. Also getting good results capturing
finer details like fence rails may reqire a higher resolution of your shadowmap.

To bake the shadows would depend on how you are texturing your terrain. If you
use one large texture per terrain, then in an image editor, you could invert
the shadowmap and use it as a mask on a black layer above your terrain layer.
Adjust the transparency of the layer, and then collapse them into a single image.

You could also use the existing ffp shader in the example or, modify it if you
are using a multi texture shader. The example shader tiles skin 1 but not skin 2
(the shadow map).

I have made fantastic results with sewn together terrains that each use just
one large texture that includes the shadowmap, and a detail mapping shader.

Sorry I didnt include better usage notes!



Posted By: broozar

Re: Terrain Shadows - is it possible? - 09/04/06 07:33

excellent works fine, thanks a lot!
Posted By: ShoreVietam

Re: Terrain Shadows - is it possible? - 09/04/06 11:47

I modified the wiki terrain shader, I multiply the color result with the alpha map and disable alpha blending.

To create the alpha map I wrote a raytracing function that makes 4 traces per alpha-map pixel to get a rough "darkness factor" for the pixel.

The result looks like this, but is a static shadowmap because it takes ~3 minutes for 500.000 c_trace. O:-)


© 2024 lite-C Forums