|Topic was automatically imported from the old Question2Answer platform.
I’ve been blocked on a problem for the last two days in my project, this problem concerning the use of shaders.
Consider the following : I have a certain shader A, let’s say a texture. This shader is totally opaque, colored and is applied to a certain mesh. For various reasons, I would like to make certain pixels/vertices more or less transparent, with the help of a shader B in the next_pass category of shader A.
Can such a shader B exist, so that if he is applied to the “next_pass” category of any shader A he will affect the transparency of given pixels ? Or do I need to write a different shader A that will include the functionnalities of shader B ?
In my case shader B makes the pixels more or less transparent depending on the angles of the normal : I apply it to meshes of a MeshLibrary, those meshes being parts of a building. With a shader B like that, I could make the walls invisible, if they are a certain angle, and close to a certain coordinate (probably the player’s point of view).
Ok. So if I’m understanding correctly, you want a shader that’s opaque in some parts, but transparent in other parts yes? Couldn’t just make one shader that does all that? Why would you need two separate shaders exactly?
SIsilicon | 2019-09-24 01:48
So in my project there’s a skyscraper, made of a Gridmap. The player has a camera revolving around this skyscraper, but it cannot go inside it. Instead, to see what happens inside, I was thinking it would be great if, when the player’s camera is near enough, the walls near where his camera is could become invisible.
So right now I think I need two shaders because the “shader B”, who would make walls invisible around a certain point, could be applied to every member of the MeshLibrary attributed to the GridMap. As such, there would be less ressources used and, when the position of the camera changes, there would be only one shader parameter to change.
I was thinking this was a good solution, but I don’t know if it is feasable right.
One last thing, is that the members of the MeshLibrary are meshes imported from .obj, those .obj being created in Blender. As such, I would like if it was possible to not touch the original Material of the imported meshes.
TheFamousRat | 2019-09-24 10:32
Very cool ! That’s practically exactly what I want. Do you think I can add my idea of making walls somewhere in this pipeline ?
If you want you can add your previous comment as an answer, so that I can validate it and so that some people in my situation can find your answer
TheFamousRat | 2019-09-24 20:16
That’s what I plan on doing
And yeah. I don’t see why you can’t have this with your walls. It’s just a material after all.
SIsilicon | 2019-09-24 20:16