Light vs shadows - a few tips

MaXyM

Hello all.
Last time I found some rf issue when working with cars. It push me to write some notes/tips and share it with you.
especialy in area of emmiting light objects. There are a few in this category

-headlights (hlglo_) - HlightDS and HlightPS instances
-stoplights (blglo_) - BLIGHTDS and BLIGHTPS instances
-taillights (hlglo_) - HlightDS and HlightPS instances
-rainlight/pitlight - RAINLIGHT instance
-warning/information lights on dashboard
-render targets for telemetry data on dashboard (speed, rpm, position etc)
-other lit elements like background of LCD display

Light emmiters
First issue I found in a lot of mods is that shadows are dropped on light sources. Source light shouldn't be dimmed by shadow! It still emitting the same amount of energy. Of course in real some amount of light comes from evn reflected from the objects. But in case of leds or stop/head lights we may ignore it.
There are two methods to avoid this:
- disable receiving shadow in gen file for object
- set Glass attribute for lit material.

I think both methods are good enough. To better organize objects, it may be even better to extrude all lit objects into separate gmt file and disable shadow for this.
You will see, that effect is very impressive, while going under shadows, whole cockpit but lights gets darken. Or cars goes darker but headlights are still powerful.

Texture anim
Second thing (related to lights but not only) is an animation. Lights like stop lights, rain lights, headlights use animation fired by Event. There are situations when you may want to use the same texture for different objects. For example some cars uses 3rd stop light to be also rain-light. So why to not use the same texture?
No - you may not. Using the same texture, it will cause conflicts and only anim of first loaded material will be used. For example stop light will work but rain-light wont. It is enough to duplicate texture, make rain-light to use new one, and everything will start working as expected.

So, do not use the same texture for animated materials fired by different events.

In car windows
There are two issues with windows. Both may be solved at once. In first case some objects may be rendered inside a car. It is because materials of those objects are set to blend (blend multiply in 3dsimed) as well as windshield is. Such materials are not sorted when rendering scene, that's why sometimes other objects appear between camera and glass.
The solution to this is set Glass attribute. It will give infor for engine to render this object at the end.

Second issue I saw in some mods (usually conversions) is shadow dropped onto glass when sitting incar. Again, what human sees is the light. Light going through an object (windshield) cannot be affected by shadow casting onto this object. in short, make sure windshield (and other windows) has not set to receiving shadows. But even better is to set glass attribute.

Hope it will help beginners at least.
 
Hi MaXyM, thank You for your tips.

I have a question for you: I tried to put three mesh for each Hlight instance, but switching on and off the lights only first mesh turn on and off pressing the Light key.

Here's an extract of my .GEN file; HLGLO_?S.GMT represent the lighted headlight, and HLGLO_?s_?.GMT represent the light flare as Light Flare Tutorial by Siim Annuk.

Instance=HlightDS //Headlights -Driver Side
{
Moveable=True
MeshFile=HLGLO_DS.gmt CollTarget=False HATTarget=False LODIn=(0.0) LODOut=(500.0) ShadowReceiver=False
MeshFile=HLGLO_DS_2.gmt CollTarget=False HATTarget=False LODIn=(0.0) LODOut=(500.0) ShadowReceiver=False
MeshFile=HLGLO_DS_3.gmt CollTarget=False HATTarget=False LODIn=(0.0) LODOut=(500.0) ShadowReceiver=False
}

Instance=HlightPS //Headlights -Passenger Side
{
Moveable=True
MeshFile=HLGLO_PS.gmt CollTarget=False HATTarget=False LODIn=(0.0) LODOut=(500.0) ShadowReceiver=False
MeshFile=HLGLO_PS_2.gmt CollTarget=False HATTarget=False LODIn=(0.0) LODOut=(500.0) ShadowReceiver=False
MeshFile=HLGLO_PS_3.gmt CollTarget=False HATTarget=False LODIn=(0.0) LODOut=(500.0) ShadowReceiver=False
}

As you can see on this screenshot, with headlights off is even possible to see HLGLO_?S_? meshes (the light flares).

2012-04-04%200948.jpg


I cannot assemble all the meshes in a single one by side because lens flares will not work as they should.

Any advice? thanks
 
I'm not sure if in case of headlights, only hlglo_ps and ds files are valid. I did some experiments in a past and I remember there were some limitations. But currently I cannot confirm it.
If multiple objects are allowed in HlightDS and HlightPS instances, then check animation of flare materials (ie loading it into 3Dsimed). It should be set to Event: 0,1, transparency should be set to multiple. Additionally check if your 0-texture has black alfa-channel, and 1-texture has lit-one.

But at the end, I suggest to use SRPL ShaderPack. There is visual editor which is really helpfull editing things. And results are just impressive. Using it I always add flares into hlglo objects.
 
Hi MaXyM, thanks to you I found my mistake: I forget to set the animation {0,1} ... that's because I have some difficult to export animations directly from 3D Studio Max 7, as You can read some lines below I have to re-save animation mesh with 3D Simed.
Today I will make some test in order to add the animation also to lens flares maded with Siim Annuk shaders.
I will study also the SRPL ShaderPack as you suggest.

I have some other questions:
1- I use 3D Studio Max 7 with GMT Converter v2.35 for Max 6 . When I want to set an animation, I can choose Cycle, One Shot, Random, Pendulum, Transient, and Manual... Do You know if setting "Manual" is the same that setting "Event" on 3D Simed?

2 - What is the event that let rainlight / pitlight to be activated? is this the Speed Limiter Key?

thanks for all
 

Back
Top