TheOverfloater / pathos-public

Public release of Pathos Engine
MIT License
39 stars 9 forks source link

how do dlight works? #26

Closed valina354 closed 3 months ago

valina354 commented 4 months ago

in shader its very confusing and im going crazy trying to understand, im adding two blended textures in my engine based on this and it works fine except when a dlight is there it goes away, i added to combinetexturelayers this which is fine i think and c++ part is fine but when dlight is on its just like gone, i fell like its got to do something with dlight so shadertype 5 but idk why its so strange image image

this is with flashlight off image

and this with it on image

TheOverfloater commented 4 months ago

You need to make sure you are also doing this when you are performing the multiplication with the texture after the lighting stage. That stage is done here: https://github.com/TheOverfloater/pathos-public/blob/0fcd9b765a872ac5c08346dae1282ff19e9ae0ad/pathos/sources/codesrc/engine/renderer/r_bsp.cpp#L3177

As you can see, it is setting the determinator for either "shader_main_detail" or "shader_texunit1". You need a matching version of your texture blending solution for these particular shaders as well to make this feature work with multi-pass rendering.

valina354 commented 3 months ago

yup that seemed to be issue as now it shows for dlights too tho i have reached a new issue where for some reason blending is occuring on different textures where its not meant too, its only meant to show on redbrick01, but it also shows on slate floor for no reason, did add a new branch called twoblended in shader, i also tried adding an else here but for some reason it breaks the twoblended too, since you know the engine you might know why this could be happening if this is C++ related or shader @TheOverfloater image image image image image

valina354 commented 3 months ago

this is my bss shader btw i really dont know what to do cuz i got blending like working but it shows up on other materials that arent meant to bsprenderer.txt

valina354 commented 3 months ago

and r_bsp.cpp is this maybe im just binding wrong in wrong places? i followed how mt_tx_luminance binds maybe you know how to bind correctly if im doing it wrong? r_bsp.txt

valina354 commented 3 months ago

i also noticed it occurs to ao maps i added to my engine too so i think its way im binding textures, but at this point i just realized that you can probably just add 2 textures on 1 main texture so im probably gonna just do it manually to prevent all these errors

TheOverfloater commented 3 months ago

You need to make sure you are resetting the "twoblended" and "ao" determinators to 0 if you are not using them. Otherwise they will remain enabled for objects that do not need them, and you'll get blending on textures you don't want it on.