UNITY SHADER GRAPH with Fake Interiors Shader
HTML-код
- Опубликовано: 11 сен 2024
- We will make a fake interiors shader in Unity Shader Graph tool. We gonna cover a technique called "Interior Mapping" which widely used on many AAA games including recent PS4 Spider-man game.
You can use this shader in your projects, by doing that you will also learn fundemental nodes of shader graph.
Here is the link for Joost van Dongen's paper:
www.proun-game....
Full Project Source:
github.com/m3r...
Thank you for the detailed explanation of the process. I watched some other tutorials but they didnt explain each step, so it felt like too much black magic. This helped me know what the nodes are actually doing
Amazing! It is very obvious that you've mastered this topic!
Awesomely done! I'm really glad you adapted Van Dongen's paper on this!
Thank you! There are awesome usecases of it. Low poly cars, buildings etc. And the awesome part is its just a quad! Which means entire 3d look gets rendered really really fast!🙂
Too much compute skill made me brain explosion ,but soooooooooooo awesome!
What an amazing technique. Thanks for the detailed tutorial. Subbed!
Thanks mate I was searching this topic a few weeks ago and today I found solutions to my problems =)
I am glad to hear that! :)
"when you look at a window from a very fine angle, reflection increases a lot"
Yeah, that's the Fresnel effect, which you already added in. Potentially tweaking the power value would have given you the desired effect without adding in a dozen more nodes? There's also a bunch of inverting coordinates that might be able to be factored out?
Other than that, really neat technique. I wonder how difficult it would be to add pseudo lighting from outside into the rooms...
Hi Tobias, that might be true😅 Answer to your second statement is, yes it is doable to add a pseudo lighting. Interior mapping uses raymarching to March a cube. So it is very well possible to apply a phong lighting with a few more nodes.
Thanks, that was helpful and cleaned up my graph.
If you want to get really anally retentive about it, you should call it total internal reflection (TIR). They just happened to call the specific shader effect 'Fresnell' in computer graphics, though Fresnell studied TIR and advanced our understanding of it greatly, he didn't discover it or coin the term.
And ideally you want to base this effect on the index of refraction of the material for the most realistic result. Which should be 1.5 for glass, in the Fresnell node, not 0.7 as was put in the video, that's why there was not enough reflection, as the smaller that number is, the closer sideways you have to look at the surface to get TIR.
@@PeppoMusic it's called Fresnel because it's computing the Fresnel coefficient, using equations that Fresnel derived. He wasn't the first to realise that the amount of reflection vs refraction is dependent on the angle of incidence, but I believe he was the first to come up with equations for it.
It would actually be less accurate to call it TIR, as that's a special case where all of the light is being reflected, whereas the node is also computing angles and indices where only part of the light is reflected and the rest is refracted. In those cases, the reflection isn't "total" (and as we're working with surfaces rather than solid volumes, "internal" is a potentially misleading term).
How's that for anally retentive ;)
I'm not interested in unity but watched it anyway! Nice video btw 😊
Thanks😊
Great tutorial, thanks!
very cool!
Tysm for the video, this is so awesome! Instead of creating the whole interior just implement this Fake Interior shader.
Hi, thank you so much for your video tutorial; it really inspired me. However, I have a small question: why do I need to use 1 divided by the product of view and -1?
tysm for this video this is so epic
Saol kardesim, cok yararli bir video.
Really nice! Thank you!
Wadsworth’s constant applies
This is amazing
This is so awesome, thanks
9:09 thank you for covering this: it has bitten my ass soo many times..
大佬太牛了!给你疯狂点赞!
thank you so much
You're welcome!
Very well explained an advanced topic!
Thank you 🙂 I hope it will be useful for everyone!
Sir, How can I get that unlit mode in my shader graph?
Teşekkürler gerçekten mükemmel bir video olmuş
Cool! Thanks.
Thanks for the video, I managed to re-create it in a different shader editor called Amplify Shader editor. Only one thing I've noticed, do you know why around the intersections of the walls, the interior is distorted? And is there a fix?
Yes, it depends on the imaginary cube's scale. I mention it on the video. You can adjust the scale to fix it.🙂
Fantastic video. Thank you for this!
Does anyone know who to modify the shader to create a parallax effect with an additional texture? To basically make it look like there are objects inside the room that would have a parallax effect relative to the back wall.
Amazing!
Thanks a lot for the tutorial. I was looking for this effect a long time.
I hope that people start using it more often in their games. Its basically almost performance cost free better graphics :D
Most of the open world games can benefited from this. My game isn't open world. But some extra details without performance cost? Why not?
Undoubtedly!
Does it improve performance? Or would it be better to just render a non-parallax texture of a interior model then project it onto a cube. Asking for my massive open world game.
Consider the polygon count, a cube has 6 faces, as far as I can see this only needs 1 face, so for each window you have 5 more faces, so for example with 10 windows, you have 50 additional faces, that'll really raise the polygon count, which will impact performence.
@@medafan53 But a shader to simulate all these faces are more expensive than poly count. I've seen benchmarks and it's only worth it when you use it in hundreds or so.
the preview images in my nodes don't look like yours. It's seemingly random whether they are square, like yours or round/spherical. It has the effect that I end up with a circle where only the upper right corner has the cubemap applied and the other three quarters are black... any ideas?
I found something. It suddenly worked fine when I put in the Blue value from the split node (that splits the UV) into the R and G of the combine node.
Güzel olmuş, ellerine sağlık
Very nice tutorial! but I am getting a weird effect, if you resize the quad where the material is applied so that it becomes a long rectangle, the effect looks very distorted. It only seems to be working on squares, is this a limitation of the method or am I doing something wrong?
Hello, I'm trying to use this method in Blender but it doesn't seem to work.
Most of the shader nodes are the same but some have different names and that makes it harder to copy into Blender.
WAUUUUUUUUUUUUU
Thank you
I followed your exact steps, and my side walls are working. Not the back one though. The wall that's supposed to be "the back" of the room doesn't look flat, but is infinitely extending into a single point it seems. Maybe not wuite infinately, but i justneed a way to flatten it out.
Could this be the best way for optimizing a 3D game based on file size and computing power. Or does it take more resources to render and more storage space?
Generally speaking, shaders are the fastest way to render things in a game, but it entirely depends on what you are doing with them. In this case it is not a concern. Storage space depends entirely on the image resolution and format.
Interior Mapping/Fake Interiors should be faster. Cyberpunk 2077, The last of us part 2, even hypercasual mobile games all of them use this method. So it is pretty cheap and pretty fast. Unless you have too high resolution cubemaps, you should be fine.
@@MertKirimgeriGameDev Thank you for the tuts, it'll help alot in optimizing my game.
Do you generate the cubemaps with reflection probes or another way? I'm finding the effect looks right when the reflection probe is centered in a room, but not if it's off-center like at a doorway or window.
I used camera's render cubemap function to produce a cubemap
Thanks so much for this explanation, do you know how to rotate the projection, if the building tilted??
Hi, you need to apply a rotation matrix to our calculation.
such a great explanation really looking forward to use this shader!
does anybody know how many batches it produces? lot of sampling in there...
Hi mert! Is it possible to get that much realitic looking glas reflections like that spider man game..If it is which nodes we need to work on?
You might wanna bake reflection probes around your window. Then adjusting the smoothness value should blend reflections with probes.
@@MertKirimgeriGameDev Thanks for the suggestoin I'll try
Hey, man. Can I use the same shader to simulate a fake exterior?
It's even simpler to make a fake exterior. you can just sample the cubemap or a hdri directly with your view angle. the extra math in this is specifically to line the edges up with the window and to make a cube projection within the window, outside doesn't need to be a cube though
Sen nasıl bir kralsın
Hey, does this technique also work with HDRP? Saw another tutorial and that didnt seem to work with HDRP
Absolutely! I tested it with HDRP too! Same nodes, same workflow. Nothing else needed! Since this technique is technically so naive, it should work with even a potato😜
@@MertKirimgeriGameDev awesome will try it this week, thanks a lot!
Good luck!
I love this! Really great job! One thing Im looking to achieve in my shader is instead of a cubemap use a texture, how I can modify it to make in works ?
I tried but the walls, floor and ceiling looks super strech like 1 pixel of the texture. Thanks
Hey Luis! Do you have a projection texture? Or separate texture for per side?
@@MertKirimgeriGameDev I have a tile texture of 2x4 containing 8 different interiors. So each interior is square like a perspective projection having the top, down, sides and front of the room.
Another thing I wanna do is those 8 interiors by random.
Something like Forza 4 will be amazing
www.artstation.com/artwork/581r9O
I see. It is possible with shadergraph but requires a bit of work in "virtual room size generation nodes" that I mentioned in the video. I can give you some resources that you can use for research. I'll probably hit another message here as a follow-up later today.
@@MertKirimgeriGameDev Thank you!
What's the music in the first few minutes?
Honestly, it's been a while I made that video, so I can't recall. If I can find it somewhere under my archive, I will update this post.
how to make it work in hdrp ?
This should work the same in hdrp
Great video, thanks!
But why camera man is so sadly breathing? He sounded very tired or bored :-)
Haha, my brother was recording it and I guess we shoot some sequences a couple of times. So he was literally tired lol
nice can i kill the beef thing
The tutorial is irreproducable in unity 2021.
It still works great in Unity 2022 URP. In my case, I had to use "Sample Reflected Cubemap" node
Ъ
HI MY QUESTION IS WILL THIS WORK IN MARMOSET OR MAYA ??? I KNOW ONLY THESE 2 SOFTWARE ... PLS ANSWER