SOLVED transparency and glow

ancient_3

New Member
Hello all modders !

First post here, I'm new at modding but worked recently on some updates for Rouen-les Essarts (Mad Brain) posted here at OT: https://www.overtake.gg/downloads/rouen-les-essarts-update-madbrain-version.79478/

Right now I would like to add some night lights. I found the ext-config.ini from @fughettaboutit (thanks ! and if he agrees, I will convert them for the 72-94 layouts (which have different meshes and materials name)

Anyway, while adding pole and spot lights in the different turns, I encountered an issue that I'm not able to solve myself.

I was able to produce the light series using the trick of creating a blender cube that I fill with a transparent texture. But when it comes to glowing, I'm not satisfied by the result:

With transparent texture, I obtain this when glowing at night :
Screenshot_ks_porsche_911_rsr_2017_rouenlesessarts_3-9-125-8-27-36.jpg

where I would like that:
Screenshot_ks_porsche_911_rsr_2017_rouenlesessarts_3-9-125-8-29-13.jpg

that I can obtain if I change the BLEND_MODE to OPAQUE. However, if I do this, the object become visible during the day.

My code in the ext-config.ini is :
[MESH_ADJUSTMENT_...]
ACTIVE=1
MESHES=OBJ9999?
IS_RENDERABLE=1
IS_VISIBLE=1
IS_TRANSPARENT=0


[SHADER_REPLACEMENT_...]
MATERIALS = bulb
SHADER = ksPerPixelAT
PROP_... = ksAlphaRef, 1
BLEND_MODE=ALPHA_TEST

[MATERIAL_ADJUSTMENT_...]
ACTIVE=1
MATERIALS = bulb
DESCRIPTION=lights
KEY_0=ksEmissive
VALUE_0=255,173,76,1
VALUE_0_OFF=ORIGINAL
KEY_1=ksAlphaRef
VALUE_1=-193
VALUE_1_OFF=ORIGINAL
CONDITION=NIGHT_SMOOTH

The screenshots are obtained with a texture that is already in the track (marshglass.dds)
If I change the ksAlphaRef in the shader replacement, nothing change
If I change the BLEND_MODE to OPAQUE, then it works but the texture become visible during day
If I change the texture to a full transparent png in blender and in the fbx.ini, it is not visible during the day, but I'm not able to make it glow

At some point , I was able to use the GoogleMap.png to make it transparent in some way and still able to shine but can't retrieve what I did !

I suspect I'm messing something with the alpha channel of the resource but I'm in no way an expert in this area so I'm lost, any help would be much appreciated !
 
Last edited:

fughettaboutit

aka leBluem aka Please Stop This
glow for transparent materials only with "ksPerPixelAlpha" shader
its very limited, only has one diffuse texture-slot, but it has only that part glowing, which is not transparent...
[SHADER_REPLACEMENT_...]
MATERIALS = bulb
SHADER = ksPerPixelAlpha
...
 

ancient_3

New Member
Thank you for your answer !

I tested it but it did not work: with ksPerPixelAlpha, I had no glowing at all. I also noticed something had to be wrong with the texture because modifying the alpha value did not change transparency.

So I started from scratch with a new texture: I created with GIMP a 224*224 png filled in white with an alpha channel. Saved it in /texture.

then opened Blender, changed the texture file for my bulb material to my white square.png

then modified the fbx.ini to:

[MATERIAL_349]
NAME=bulb
SHADER=ksPerPixelAlpha
ALPHABLEND=1
ALPHATEST=0
DEPTHMODE=0
VARCOUNT=6
VAR_0_NAME=ksAmbient
VAR_0_FLOAT1=0.2
VAR_0_FLOAT2=0,0
VAR_0_FLOAT3=0,0,0
VAR_0_FLOAT4=0,0,0,0
VAR_1_NAME=ksDiffuse
VAR_1_FLOAT1=0.2
VAR_1_FLOAT2=0,0
VAR_1_FLOAT3=0,0,0
VAR_1_FLOAT4=0,0,0,0
VAR_2_NAME=ksSpecular
VAR_2_FLOAT1=0.1
VAR_2_FLOAT2=0,0
VAR_2_FLOAT3=0,0,0
VAR_2_FLOAT4=0,0,0,0
VAR_3_NAME=ksSpecularEXP
VAR_3_FLOAT1=6
VAR_3_FLOAT2=0,0
VAR_3_FLOAT3=0,0,0
VAR_3_FLOAT4=0,0,0,0
VAR_4_NAME=ksEmissive
VAR_4_FLOAT1=0
VAR_4_FLOAT2=0,0
VAR_4_FLOAT3=0,0,0
VAR_4_FLOAT4=0,0,0,0
VAR_5_NAME=ksAlphaRef
VAR_5_FLOAT1=1
VAR_5_FLOAT2=0,0
VAR_5_FLOAT3=0,0,0
VAR_5_FLOAT4=0,0,0,0
RESCOUNT=1
RES_0_NAME=txDiffuse
RES_0_SLOT=0
RES_0_TEXTURE=test_bulb.png
then, compiled the fbx in the kn5 with this modified fbx.ini.

then in ext_config.ini, I checked IS_TRANSPARENT to 0 in my object "bulb" shader replacement

and finally with this code:

[SHADER_REPLACEMENT_...]
MATERIALS = bulb
SHADER = ksPerPixelAlpha
PROP_... = alpha, 0
BLEND_MODE=ALPHA_TEST
I'm able to see the change in game when changing the alpha value and can have a transparent bulb object during the day.

But the material is still not glowing at NIGHT_SMOOTH so I'm still wrong somewhere but also lost again ...

EDIT: have forgot to say that if I get IS_TRANSPARENT to 0, ALPHA_BLEND does not work well, I have to use ALPHA_TEST and with this configuration, PROP_... = alpha, 0 makes the object transparent during day but not glowing whereas PROP_... = alpha, >0 makes the object proportionnaly visible during the day with proportional glow . I tried to put PROP_... = alpha, 1 in the material adjustement so that it would be under condition but does not seem to work
 
Last edited:

ancient_3

New Member
OK so finally I found something :) the problem was apparently in how I set the alpha value in the MATERIAL_ADJUSTEMENT

So with object set as active, visible, renderable but not transparent (=0), texture of the material being a simple png filled in white with alpha channel

[SHADER_REPLACEMENT_...]
MATERIALS = your_transparent_material_here
SHADER = ksPerPixelAlpha
PROP_0 = alpha,0
BLEND_MODE=ALPHA_TEST

and then,

[MATERIAL_ADJUSTMENT_...]
ACTIVE=1
MATERIALS = your_transparent_material_here
DESCRIPTION=lights
KEY_0 = alpha
VALUE_0 = 1
VALUE_0_OFF = ORIGINAL
KEY_1=ksEmissive
VALUE_1=255,173,76,1
VALUE_1_OFF=ORIGINAL
KEY_2=ksAlphaRef
VALUE_2=-193
VALUE_2_OFF=ORIGINAL
CONDITION=NIGHT_SMOOTH

The only strange thing is that I was never able to see the white color in game when setting alpha to 1 (was grey in the game)

Sorry for the rambling and thank you again (I hope you don't mind if I keep your values for emissive objects in Rouen-les Essarts that are in all layouts and cite you in the author night lightning part)
 
Top