Closed valina354 closed 3 months ago
@TheOverfloater
i notice when entering dlight area this stops triggering inside of BindTextures everything else too most likely causing the issue
when outside of dlight only bindtextures runs, and when inside dlight only drawfirst runs, i dont get what im doing wrong, im doing exact same as mt_tx_luminance
it also occurs for mt_tx_ao i added
this is my entire r_bsp.cpp to btw https://pastebin.com/gmPaQQtE
I'm afraid I can't really help here unless I were there to debug the code myself. Basically you need to use the debugger yourself to see why it doesn't trigger to begin with, it means you could be trying to use the wrong material, or that particular texture unit itself is being set to null for some reason. VS2022 allows you to set a breakpoint that triggers when a value in memory is changed, it is called a Data Breakpoint.
i notice same thing occurs with mt_tx_luminance but in luminance it doesnt break it which is strange and it also cant be shader related because same thing occurs with ao which is well very simple just multiply by binded ao map so very strange
i figured out i need to also blind in drawlights however it seems to cause another issue, for some reason it seems only normal and specular gets displaced, not maintexture while without dlight it renders fine very strange
it seems that for some reason when doing dlight it doesnt bind maintexture but even manually binding it doesnt fix
i now tested with default luminance and even that is broken, doesnt work correctly in dlight area, i wonder if i somehow broke some code in r_bsp.cpp that is causing it its like hardest thing to debug
i love this engine a lot but the way rendering system is done is just so confusing in my opinion, like theres drawfirst,drawfinal,draw lights, and probably other places where you bind textueres, binding textures is literall more complex then the shaders themself, like in most other engines you just bind the textures in 1 function and thats it
i guess my only way is to try and copy paste how MT_TX_NORMALMAP binds textures and hope it works but i dont even know if that will work
i tried repeating similar to MT_TX_NORMALMAP but unless i did it wrong it stll happens, it basiclly seems to pretty much paste the same ao map on another unrelated textures and i cant tell why
btw if you want to check it out yourself the issue engine is here https://github.com/Soft-Sprint-Studios/Matrix-Engine
for vbm i literally just did this in drawmesh and it worked for both dlights and normal lights while bsp is lot of stuff
ok, so the only thing i can think of is that determinators are past 4096, basiclly i raised the limit to 8192 in C++, im not sure if that could be like causing it? has it been tested if more then 4096 determinators can work at same time? because with the ao and parallax i reached 7000 determinators @TheOverfloater
i also didnt add r_checkshaderuniform to all of them but i dont think thats issue
ok, so the only thing i can think of is that determinators are past 4096, basiclly i raised the limit to 8192 in C++, im not sure if that could be like causing it? has it been tested if more then 4096 determinators can work at same time? because with the ao and parallax i reached 7000 determinators @TheOverfloater
i removed screen space normals termporarily to get it down below 4096 but that didnt fix it so its not issue that
omg ok, so i added ao and parallax here and it seemed to fix it! ao fully works fine without bleeding into others, however
however parallax breaks with a dlight, this no dlight and this with dlight
i think dlights how they render somehow coincide with parallax or somehow break it i need to test more however
ye its caused by the weird strange bug from before with for some reason on dlight only showing parallax on normalmap i dont understand how i would fix it
Without seeing the shader code, and the BSP Renderer changes I cannot really tell what is wrong, but I assume you would need to account for parallax mapping both when rendering the first pass(lightmaps only), then account for it with each individual dynamic light, and finally account for it again in the third pass(rendering the texture, then rendering specular highlights, cubemaps). Make sure you have these stages also account for the parallax mapping, otherwise yes, it will break.
i seriously dont know what to do, i added to drawfinal as its final place to bind shaders that wasnt there and yet it still didnt fix it, this is my r_bsp.cpp https://github.com/Soft-Sprint-Studios/Matrix-Engine/blob/main/matrix/sources/codesrc/engine/renderer/r_bsp.cpp and this is the shader https://github.com/Soft-Sprint-Studios/Matrix-Engine/blob/main/matrix/scripts/shaders/bsprenderer.bss if you like have any free time to check it out because tbh i dont know myself i have been checking for last few days and cant figure it out
the only thing i can think of is issue in drawfinal but i cant figure out how to fix it if that is the issue
i notice without a diffuse texture so only normal,specular,ao and height it seems to look normal, could that point to something? like related to diffuse @TheOverfloater
i checked with nsight and the parallax goes away for diffuse during where it binds the diffuse texture as it shows this with nsight, you can see parallax working fine right before diffuse gets binded (also why is it getting binded sepeartly?) https://github.com/TheOverfloater/pathos-public/assets/80889633/159782c7-1143-4869-88e0-db8ccda3b060
tested with no dlight, directly binds diffuse and all textures at same time, causing no issue, so that might be issue, unless im wrong
got screenshot of it dirrectly light on the surface and parallax there rightbefore binding diffuse
it seems it doesnt actually bind texture but just redo gldrawelements for some reason and then parallax breaks there, which seems to contain maintexture and height texture
it seems to defintly be issue maintexture, but issue is i cant hook up vs 2022 debugger and nsight at same time to go through code and see whats causing it
i have a felling its related to drawfinal but im not sure as it seems correct
i did even more tries at fixing yet still unfixed
i think i will try to remove everything i did about mt_tx_height in r_bsp.cpp and try again from fresh start copying how specular,normal do it to bind and set for dlights and stuff
I haven't yet had time to check on your code, I am still busy with IRL things and I am also working on the next major Pathos update. Once I am done with these things, I can examine your code and try to see what might be wrong. However, based on my own experience, it's sometimes good to start from scratch. It's part of the learning process.
i tried starting from fresh and copy and pasted how normal does it yet same issue so hopefully you can check it out soon
tbh its very annoying how like the C++ part is way more complex then shader itself im spending more time trying to fix C++ part then i did with shader which at start i thought would be most complex thing
i do notice normal maps even break parallax somehow, heres with normal map and no normal map (well full blue normal map) so im not sure why thats happening i think its an issue with how normal maps render in engine, like what i mean is normal map isnt in correct place with parallax depth causing it to look weird
nvm figured out it was shader issue so i fixed it, only issue now seems to be with dlight, this is what happens with dlight now, for some reason diffuse texture goes bye bye, and performance goes bye bye too so hopefully you can try to investigate the issue cuz im so close to getting it working, i think it seems like it renders surface 2 times with parallax or like 3 times (draw first,draw lights,draw final) causing too much performance loss)
i fell like going crazy tbh cuz i have checked everything i can think of, and its very important i get it working asap since im gonna make test maps and make my first game based on this and just in general have working parallax cuz it looks cool
im trying to debug more myself, like testing if d_parallax isnt true when in drawfinal cycle but for some reason it says unable to read memory so i kinda cant when checking 'this'
i tried to retry doing like how specular does it and it seems to work better, it fixes issue of diffuse texture going bye bye, but still parallax doesnt show and it creates these weird darker areas, but its similar to how specular does it so debugging should be easier when you check it out
i decided to change it more so its just how mt_tx_luminance binds which means it doesnt do anything with dlights now, but i have still been trying to debug it almost nonstop and still havent figured out and i dont know what to do anymnore, just this tiny bug is preventing me from being able to continue making my game because i want to use parallax mapping i added work with dlights as i want to use it in combo for maps to make them more realistic and make engine fell less like 2000s but due to this i cant, i have literally been trying everything, i asked chatgpt too and showed it code and it was like 'it doesnt seem like something is wrong in this code please make sure you are correctly doing parallax mapping' so even chatgpt which has helped me in past cant help, so really hope you can check it out soon
I cannot guarantee I will be able to debug this very soon. I have about 3-4 other projects I help out with code, my own video game project on Pathos, and I have a full-time job at the same time I need to deal with. I will take a look when I have some free time.
I cannot guarantee I will be able to debug this very soon. I have about 3-4 other projects I help out with code, my own video game project on Pathos, and I have a full-time job at the same time I need to deal with. I will take a look when I have some free time.
ok, im continuing to debug it myself and i noticed even when theres a dlight the drawfirst still runs and runs this but bindtexture no longer runs because i see theres code to prevent that when multipass so that could be issue, but im looking through code and i kinda dont understand what drawfinal is meant to do, is it to like overlay the dlight on the textures or something?
i think its quite important i fix it since the parallax mapping looks so good it looks like this, in my opinion it turns the engine from looking like 2000s to bit more modern
i also fell like theres a tiny tiny bit of chance that maybe its caused by parallaxscale and parallaxlayers param not binding when in drawfinal, because i notice the surface darkens when parallax and dlight on which signals parallax is on? im not really sure how i would check that because vs 2022 debugger says 'unable to read memory'
i have literally tried everything now and still nothing, my only hope is if you figure out the issue when checking out the code
not related but i just noticed the new major pathos update released, i dont know how i will merge it into my branch tbh bcz its so massive and since i store my matrix engine on a company i dont have the merge button anymore, i guess i will have to merge it manually by going through each code
actually because of fact the new pathos update is so massive and i made mistake of not forking correctly i will have to restart development of matrix engine so till i get the parallax mapping back in i think you wont be able to check whats wrong
because of fact new pathos update was so massive now after merging everything the parallax no longer works it just makes texture look like this even tho the code is same from before, making it fully useless with or without dlight, so you will probably have to investigate that issue too but i sucesfully finished restarting development of my engine and readding everything so its ready to check whenever you can for the broken parallax mapping
ok i have tried everything myself but i cant even fix this new issue so i guess you will have to investigate this too when checking it out, but since the new pathos update released hopefully you can try checking it out in the future, and new url of engine based on this is https://github.com/Soft-Sprint-Studios/Matrix_Engine and all changes related to parallax is at r_bsp.cpp and bsprenderer.bss
i added parallax occlusion mapping to engine but i got issue which is that for some reason when dlights are on the texture binding itself breaks or something and bleeds into other ones i added this and this
below if(pmaterial->ptextures[MT_TX_LUMINANCE]) {
functions, in area with no dlight it looks fine like this
but in area with dlight it breaks
without height texture being defined this doesnt happen, so i think im binding in wrong places