Creating glass without using translucent blend mode?

Hello there!

I have come to the texturing phase for one of the main characters of our school game project. However, the character has parts that requires see through glass as indicated in the pictures below:

Optimization/performance wise this guy is fairly beefy in general since he is made for both closeups inside of cinematics and in-game gameplay, and the reason I don’t want to use a separate material for glass (which I guess is the “proper” way of doing it) is because he already uses up 5 materials and will be heavy enough in real time (I believe…). One hack to go around this issue would be to change the design and make the glass panels super dirty and cracked so that the actual glass is barely visible, but i’d rather not go with that approach. I also tried using the temporalDitheringAA node for the glass but I did not like the results it gave me.

So what can I do in order to have a translucency/slight opacity glass material without the translucent blend mode?

Have you tried clearcoat w/ dual normals? Type it in the search in Unreal docs to get a how-to about it.

depending on the look you’re going for, maybe a custom shader with a bit of parallax could do the trick.
But that would be a different material anyway.
I’m not sure a sixth material would dramatically increase the cost of your character. Worst case scenario, It’s be the cost of a separate glass mesh (skeletal). Since I don’t think there’s any cheap workaround, you’d better go for the simple solution of a new material. And if you’re really worried about the perf, maybe have a closer look at those 5 other materials to see if they can be merged.

Sorry i haven’t gotten back to you guys, I was too busy with finishing the game project. I just went with faking the glass through using some weird metal, emissive and spec combination that didn’t turn out that great but it worked to some extent. I looked into the clearcoat with dual normals and read the docs but I can’t really grasp how that would be a replacement for glass. I guess I’ll have to look further into it. But thanks for the advice!

I guess the easy solution would just be to add a sixth material anyways. The game is finished and performance wise everything worked out. However I didn’t want to add a sixth material to the character cause people in my group was giving me a hard time for using up to 5 materials on the main character in the first place. I made some reserach and posted on the forums asking about the number of materials and such, and it seemed like it wasn’t that unusual that a main character for a FPS used up to 5 materials. Our teacher in our last course was very strict when it came to using several materials for a single asset and such, so all of the students kind of got that mentality stuck in their head. However the teacher, who although is great, doesn’t have any indsutry experience so I make sure to take some things with a grain of salt.

Here’s the result ingame for anyone interested.

Had a really cool idea - you could use a cubemap to create a fake interior where the galss is… maybe a cockpit/bridge with a bunch of people piloting…

like they did in spiderman buidlingshttps://youtube.com/watch?v=onKSZQQCgcQor

It looks really cool. Well-done. The glass panels look like a glass, moreso than a metal. There’s a tutorial on youtube on how to create an opaque glass material, which is quite simple and looks great. I don’t know if I have the link to it anymore, but try a search. The idea to use dual normal w/ clear coat was based on how that’s used to create something like an overlay for vehicles such as sports cars and boats. It’s basically 2 materials in one, non-technically speaking, with one a thinner layer over a base texture / material. I thought a small panel mesh inside the respective parts on the robot could be the base texture, and the clear coat would’ve become the see-through glass with a low level of opacity, and perhaps a moderate amount of refraction or visible light bouncing effect.

Some of the best robot type character models I’ve seen are in the Armored Core games, and most of those are on older generation consoles. Even the robots from certain PS4 games don’t look as cool as the ACs in the Armored Core series (of From Software creation).

I don’t think that translucency in a region which is the most time very small is critical. It’s more critical if there are large regions with translucent materials and/or if there are multiple translucent materials overdrawing each other. It looks good, though. How many triangles has this guy?

Yeah I agree! Luckily the area is small and I also have yellow emission behind the “glass” most of the time as if the headlight are on (not in the picture however). The Yellow Fella is around 60000 tris. He was built for both cinematic closeups and FPS gameplay so I had him be inbetween high/low poly. The textures didn’t really hold up too close unfortunately, but I’m still pleased with him!

You can see him broken down on my artstation: ArtStation - B.1.G Construction Robot :slight_smile:

As @OptimisticMonkey mentioned, you also could use cubemaps and fake interior, which also leads to faked glass :slight_smile: RyanB had done a material, that recreated this Spiderman–material for buildings, and after migrating it to 4.25, it can look like this:

Note, those objects are just the basic meshes, a cube, a cylinder and a pyramid or cone thingie, no extra geometry for the windows, just that material applied and scaled a little bit.

https://forums.unrealengine.com/filedata/fetch?id=1765609

Well, one unsolved problem with his original material is, that it just works with vertical surfaces, and look weird on angled/sloped surfaces/windows. But i guess, someone could figure that out and install an additional math, that correct this behaviour for angled windows. Would probably just require some comparsion between the preferred angle and the angle of the surface/polygon and then modify the vectors, that are used to calculate, how that cubemap is projected on that surface. Or something like that ^.^

Link to the original thread, project is downloadable from there too:

https://forums.unrealengine.com/unre…e2#post1765608

And if you cannot copy that project to a new version, just copy the content Folder named “SemiProcedural” by hand in a new project, via explorer. Other stuff in the original project seemed to require some modding, which prevented it for me to make a new 4.25 project copy of it. But manually copying that folder does the trick.

Looks really cool!

As for the 5 materials, each additional material is an additional draw call. There is no real measurement as for how many draw calls you can have before you get performance problems cause performance depends on many different things. Generally speaking with the hardware today 1000 draw calls -> no problem, 10000 -> might give you problems.

So whether you use 5 or 15 materials won’t make any difference there. What will make a difference is the complexity of the materials (so the amount of instructions that get executed per vertex and especially the amount of instructions that get executed per pixel). If you try to put different logic into one material instead of separating it into several materials you might/will end up with a higher pixel shader instruction count.

For example if you apply the same material for the glass and for some metal parts of the robot and you want to execute some fancy stuff for the glass parts, then those instructions will also be executed for the metal parts and in such a case it would be better for performance to split it up into two separate materials.
[HR][/HR]
Just as a test to get a better feeling for it you could try to see how far you can push it before you experience performance problems. So create a plane, put 10 different materials on it, then duplicate it 10 or 100 times. That would be roughly the same as if you would use one plane with 100 (if you duplicated 10 times) or 1000 (if you duplicated 100 times) materials.

And this is always useful to learn about UE and what to consider for performance An In-Depth Look at Real-Time Rendering - Unreal Engine

Thanks for the input, surley valuable information! :slight_smile: I feel like these questions regarding optimization and whether something is going to be very taxing on the system in the long run just comes down to working on different/many project and just seeing and comparing what works and what doesn’t.