OpenBVE
OpenBVE copied to clipboard
[Question] how to gradually fade in/out texture like blendmode in b3d but its function start based on statefunction ?
as title said.
if i use the current method like this : [object] states = lampOn.b3d statefunction = if[reversernotch == 1, 0, 1]
the texture will disappear on the next frame/state.
I don't think there's anything inbuilt to do this off the top of my head. However: My immediate thought would be the TextureShiftFunction and a texture using a gradient in the alpha channel. You'd have to build the button face as a mesh, as opposed to the more common transparency method, and I'm not sure exactly how well this would work in practice without building a prototype.
Ah as i expected, i also think TextureShift would work but i dont know the formula😅, sorry i dont understand what you mean about button face is.
Another may possible is:
-
Using Headlight feature in train.xml and define the effect in statefunction? The docs said train dev must implement it but i dont know how and where i implement it, If this can we may make one for tail/rearlight.
-
Still using headlight in train.xml but with a new section based on blendmode command in .b3d like:
<GlowHalfDistance> 0 to 4095 value </GlowHalfDistance>
-
New TextureValueFunction command in .animated. modify all texel/texture RGBA value in current object state using a function.
From what i observe the blendmode in b3d work by calculating the distance between camera to object, in statefunction maybe we can use somewhat if statement like:
If[cameradistance < 5(meter), DecreaseTextureTransparency, DefaultTextureTransparency]
The closer camera to object the transparent the texture will be, if camera is below 5 let say 3 meter and stops moving the transparent should be stay on that value.