Unreal 5.3 - Making a volumetric ray marching shader from scratch (part 1)

  Рет қаралды 15,550

Enrique Ventura

Enrique Ventura

Күн бұрын

Пікірлер: 75
@Cz_Dani
@Cz_Dani Жыл бұрын
This is a goldmine for me! Thank you for teaching some really deep topics, volume rendering in unreal was always a scary thing for me that seemed too complex for me as an artist but you really break it to a logical explanation.
@EnriqueVenturaGames
@EnriqueVenturaGames Жыл бұрын
Thank you for the kind comment! :)
@christopherstrawley7024
@christopherstrawley7024 Жыл бұрын
Thank you for sharing these lessons Enrique! The videos you release always somehow line up with what I'm curious about learning in the engine and I could not be more grateful for your perspective and experience in these topics! Thanks so much!
@isaackershnerART
@isaackershnerART Жыл бұрын
This Tutorial is amazing! Ive wanted to do something like this for a long time now but never had the will to delve into hlsl and raymarching. You gave me everything I needed to get started and then some!
@EnriqueVenturaGames
@EnriqueVenturaGames Жыл бұрын
Glad to have helped get you started! Good luck and thanks for the comment!
@lordkelvin1
@lordkelvin1 3 ай бұрын
This is so well put together. Thank you! Really easy to listen to and follow along.
@MkMk-ym9hg
@MkMk-ym9hg 15 күн бұрын
That's absolutely epic!
@EnjoyLife-233
@EnjoyLife-233 9 ай бұрын
I'm sorry I can only use software to translate the reply. Thanks for sharing, and I had some problems reproducing the project. When I hook up Color (purple) into the Emissive Color, there will be a light-purple-translucency cube outside the cloud. Then I used Color (purple) multiply Custom return accumdens, and content to Emissive Color, the cloud display is correct. I'm confused about that.
@EnriqueVenturaGames
@EnriqueVenturaGames 8 ай бұрын
If you just connect the color to the emissive output, the whole mesh (the cube) gets the color applied to it. By multiplying it by the accumulated density, you are only tinting the actual cloud, because the area outside of it has a value of 0 (accumdens)
@sergiogonzalez2611
@sergiogonzalez2611 9 ай бұрын
WONDERFULL TUTORIAL MAN, JUST WONDERFULL
@EnriqueVenturaGames
@EnriqueVenturaGames 9 ай бұрын
Thank you kindly!
@elgabacho73
@elgabacho73 Жыл бұрын
Muy buenos tutoriales. Saludos!
@EnriqueVenturaGames
@EnriqueVenturaGames Жыл бұрын
Muchas gracias! Saludos de vuelta! :)
@AboutJOB-dq6pj
@AboutJOB-dq6pj Жыл бұрын
Nice video!! Thank you for the sharing this!!
@skydek
@skydek Жыл бұрын
Buenísimo ¡muchas gracias! tenia artefactos con lo del depth testing al intentar implementar el shader de Ryan Brucks, este tuto me lo ha arreglado :) Ahora a ver si encuentro forma de escalar las mallas de manera no uniforme, que por ahora se rompe la profundidad
@EnriqueVenturaGames
@EnriqueVenturaGames Жыл бұрын
Ayer estuve un ratillo intentando solucionar el escalado no uniforme y no lo consegui del todo, si das con una solucion sencilla avisa! :D
@skydek
@skydek Жыл бұрын
​@@EnriqueVenturaGames por lo que he estado probando parece que al hacer la solucion para evitar los errores de depth testing se rompe, es decir, con lo que viene por defecto el plugin de volumetrics en la funcion de VolumeBoxIntersect parece que funciona bien el escalado no uniforme. Ahora bien, no se como, pero he vuelto a lo por defecto y he visto que no tengo el mismo error que pasa en el tutorial antes de hacer el fix; la profundidad funciona correctamente ya de base asi que no estoy seguro si al final este fix del VolumeBoxIntersect es necesario ( aunque no estoy en la 5.3 sino en la 5.1, puede ser que algo haya cambiado) Seguire mirando a ver...
@hnlo
@hnlo 6 ай бұрын
Thanks so much for this tutorial, it has really helped me. I modified it to use Unreal's built in support for 3D textures by replacing the texture sample like this: SamplerState MySamplerState; float accumdens = 0; for(int i=0; i
@mikegreen200691
@mikegreen200691 4 ай бұрын
Same issue with the horizontal lines, did you every find a solution to this?
@hnlo
@hnlo 4 ай бұрын
@@mikegreen200691 I did, but I had to completely refactor the code... as far as I can tell it was because the finalStepSize was wrong. This is part of the final hlsl... float stepSize = 1.0 / MaxSteps; float totalSteps = boxThickness * max(MaxSteps-1,0); float finalStepSize = frac(totalSteps);
@Labo3D
@Labo3D Жыл бұрын
Amazing! After a little bit of extra work i decided to integrate the shadows too , was wondering, do you think it would possible to take in consideration the the non uniform scale of the mesh? As for now if the mesh is not scaled accordingly, it seems it's getting distance faded out on Z axis
@EnriqueVenturaGames
@EnriqueVenturaGames Жыл бұрын
Yeah I'll look into it for the next video :)
@Labo3D
@Labo3D Жыл бұрын
@@EnriqueVenturaGames you're magic ✨
@Labo3D
@Labo3D Жыл бұрын
@@EnriqueVenturaGames Just wondering, do you have a good tutorial or course to learn HLSL? I can like revise a lil bit HSLS code (as i did with this project), but i'm not super fond with starting from scratch.
@EnriqueVenturaGames
@EnriqueVenturaGames Жыл бұрын
@@Labo3D sadly I don't (yet); I've been thinking about doing a series of videos for complete beginners (HLSL, niagara, materials, etc.) but I've been too busy with work and life :)
@Labo3D
@Labo3D Жыл бұрын
@@EnriqueVenturaGames I totally understand ahah, takes a lot of time to prepare tutorials ^_^ Thanks a lot :)
@hotsauce7124
@hotsauce7124 Жыл бұрын
Question, How would we render these clouds with an alpha background so they can be composited?
@EnriqueVenturaGames
@EnriqueVenturaGames Жыл бұрын
Haven't tried doing compositing using these yet, but in a worst case scenario you should be able to make a copy of the material that only outputs transmittance, and use that as the compositing mask. I'll look into it for a future video!
@hotsauce7124
@hotsauce7124 Жыл бұрын
That would be an AMAZING future video. Thank you! @@EnriqueVenturaGames
@ooorc46
@ooorc46 Жыл бұрын
Love you! Great topic!
@Nicholas-nu9jx
@Nicholas-nu9jx 2 ай бұрын
New version of unreal has code editor for custom nodes now
@matiasadrianmahler322
@matiasadrianmahler322 10 ай бұрын
This is insanely usefull Enrique, muchas gracias!!! Disabling the depth test means it will be calculated and rendered even when occluded? Or does the distance used to multiply the steps does that optimization by reducing the render calculations when occluded?🤔
@Curryfishballa
@Curryfishballa Жыл бұрын
I've got error on the PseudoVolumeTexture function where the TexSampler is unidentified. Any idea how you it worked for you and not me?
@EnriqueVenturaGames
@EnriqueVenturaGames Жыл бұрын
That is a quirk of the custom node in Unreal. If your texture is not named "Tex", the default "TexSampler" won't work (and you get that "undefined" error). Depending on your Unreal version, you might be able to get it working with Tex.Sampler, but the easiest solution is just to make sure that your input texture is named "Tex"
@Curryfishballa
@Curryfishballa Жыл бұрын
@@EnriqueVenturaGamesomg!! Thank you Enrique, your tutorials are amazing! I can continue with the tutorial now! Also, your technical art related tutorials on youtube are really something. I’ve learn so much from you with so less!
@EnriqueVenturaGames
@EnriqueVenturaGames Жыл бұрын
@@Curryfishballa Hey thank you for the kind comments! Feel free to ask questions anytime!
@dusha3030
@dusha3030 Жыл бұрын
I can't manage to get the sampler even though my texture name is Tex. I tried both TexSampler and Tex.Sampler in UnrealEngine 5.3.
@selenepark40
@selenepark40 Жыл бұрын
in my case, I used TextureSampler node for Vol_texture, instead of TextureObject node. You may check that part too :)
@Stryper1456
@Stryper1456 Жыл бұрын
Really great stuff! Thanks for sharing! :) some help if I may? When I hook up the MF_VolumeBoxIntersect into the main shader, I can't see my cloud anymore, even though my Tex Object is hooked up. I end up seeing the box volume itself, as soon as I hook up the BoundingBoxBased UVWs, I can see the cloud once more. I don't have volumetrics enabled in this project, I did however copy and paste the MF from another project and remade it myself. All seems to compile, so I'm unsure where the error has come from :(
@EnriqueVenturaGames
@EnriqueVenturaGames Жыл бұрын
The VolumeBox Intersect function has some errors in the current version (or at least, something in the LWC system has changed so it doesn't work now). I mention it in the video, including a temporary workaround, not sure if you have done that modification and still have the error.
@Stryper1456
@Stryper1456 Жыл бұрын
Ahh maybe it's further along in the video as I haven't encountered you saying that yet, or possibly I missed it, and if so I apologise. Really appreciate the rapid response by the way@@EnriqueVenturaGames
@Stryper1456
@Stryper1456 Жыл бұрын
Yeah the fix resolved it! 👍Really great content & Support. @@EnriqueVenturaGames
@fran.fndz.techart
@fran.fndz.techart Жыл бұрын
this is great, i finish the shadow and lighting also, but im having trouble adding animation, i have added distortion effect to the volume but i want to rotate it, rotating the float3x3 WtoL = (float3x3)LWCToFloat(GetPrimitiveData(Parameters).WorldToLocal); in the Z axis does not work properly, but if i rotate the mesh in the editor it works with no issue. if u have spare time, can u try to rotate the mesh and the volume inside the material?
@EnriqueVenturaGames
@EnriqueVenturaGames Жыл бұрын
Sure, I'll give it a try!
@EnriqueVenturaGames
@EnriqueVenturaGames Жыл бұрын
Working on part 3, I'll do an entire section on animation because there are multiple options :)
@fran.fndz.techart
@fran.fndz.techart Жыл бұрын
@@EnriqueVenturaGames glad to read that. I had some issues with animation so I jumped to volume fog / vdb
@BINEHE-eq1dz
@BINEHE-eq1dz 20 күн бұрын
Hi, I have a quesiton that the material is not working in the scene but its working in the editor. It's just completely black in the scene. Is there any solutions?
@JesfNwje
@JesfNwje 8 ай бұрын
Any chance you could make a volumetric sphere cloud using materials?
@jonin-xi6kq
@jonin-xi6kq 5 ай бұрын
hello there i would insanely appreciate if you told me how to do this with an actual volume texture node because i found no volume texture node that returns a volume object instead of just uv based rgb
@leegarfield8959
@leegarfield8959 5 ай бұрын
Hello, nice tutorial, but... no "VolumeBoxIntersect" function in Unreal Engine 5.4, Impossible to follow, and it worries me, that depending on this function may cause future versions to stop clouds from working and if we scale it, it damages the cloud, question: why not a great RayMarching material tutorial like the previous one with absolute world position and atmosphere sunlight, but better quality and not splited by the cube, because that material still works today.
@Meliorat3d
@Meliorat3d 5 ай бұрын
Where you search for VolumeBoxIntersect be sure to check your filters are looking at plugins and not just C++ classes. Right next to the searchbox
@SilverEye91
@SilverEye91 Жыл бұрын
You mention the limitations of the volumetrics in the engine, however, do you need volumetrics activated for this to work anyway?
@EnriqueVenturaGames
@EnriqueVenturaGames Жыл бұрын
I don't think you need the plugin activated to follow this tutorial. Good luck! :D
@SilverEye91
@SilverEye91 Жыл бұрын
@@EnriqueVenturaGames Thanks! I have some limitations for this project, unfortunately I'm also limited to UE4. I'll probably run into some issues because of that but hopefully I will learn some things. If nothing else for use in future projects with a more modern version :D
@ashishthatipelli3279
@ashishthatipelli3279 Жыл бұрын
Can I disable the lightning in these volumes?
@jonin-xi6kq
@jonin-xi6kq 5 ай бұрын
thanks a lot i wanted to make my own voxel raytracer and even if this is still perfect
@daylight3d
@daylight3d Жыл бұрын
Nice tutorial. But it would have helpe to paste the code into the video description to copy & paste. I am not a coder and have to check 10 times that every character is in its right place.
@importon
@importon Жыл бұрын
Is the only geometric shape that contains it a cube? meaning, can I "fill" an object with this material? Basically I'm looking for a way to fill and arbitrary shaped object with smoke.
@EnriqueVenturaGames
@EnriqueVenturaGames Жыл бұрын
Since volumetric raymarchers work in voxel grids, you still need to start with a cube (of voxels). To "fill an object with clouds", you would need to sample the mesh's surface and then use that information to generate a volume texture, but the texture would still be rasterized using a cube mesh.
@Lilly_PK
@Lilly_PK Жыл бұрын
i dont get exactly how it works but it does and i like it
@haikeye1425
@haikeye1425 Жыл бұрын
Nice!
@lapotk.3150
@lapotk.3150 10 ай бұрын
@lapotk.3150
@lapotk.3150 10 ай бұрын
🎉
@RZR_Ghost
@RZR_Ghost 6 ай бұрын
getting this error after first code
@RZR_Ghost
@RZR_Ghost 6 ай бұрын
[SM6] /Engine/Generated/Material.ush:3362:88: error: use of undeclared identifier 'numFrames'; did you mean 'NumFrames'? float cursample = PseudoVolumeTexture(Tex, TexSampler, saturate(CurPos), XYFrames, numFrames).r; ^~~~~~~~~ [SM6] /Engine/Generated/Material.ush:3356:123: note: 'NumFrames' declared here float3 CustomExpression2(FMaterialPixelParameters Parameters,Texture2D Tex, SamplerState TexSampler ,float XYFrames,float NumFrames,float MaxSteps,float StepSize,float3 LocalCamVec,float3 CurPos) ^ [SM6] NumFrames [SM6] /Engine/Generated/Material.ush:3364:16: error: use of undeclared identifier 'localcamvec'; did you mean 'LocalCamVec'? CurPos += -localcamvec * StepSize; ^~~~~~~~~~~ [SM6] /Engine/Generated/Material.ush:3356:170: note: 'LocalCamVec' declared here float3 CustomExpression2(FMaterialPixelParameters Parameters,Texture2D Tex, SamplerState TexSampler ,float XYFrames,float NumFrames,float MaxSteps,float StepSize,float3 LocalCamVec,float3 CurPos) ^ [SM6] LocalCamVec
@EnriqueVenturaGames
@EnriqueVenturaGames 6 ай бұрын
Seems like you have a small typo, you typed numFrames instead of NumFrames somewhere (the error line says so); hope it helps :)
I Made A Blob Shooting Game With Ray Marching
13:33
Visionary 3D
Рет қаралды 44 М.
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
An introduction to Raymarching
34:03
kishimisu
Рет қаралды 163 М.
UE5 How to make a Slime Material in Unreal  Engine 5
23:32
Finley Southwick
Рет қаралды 804
How Not To Make An Environment
24:43
caponeart
Рет қаралды 32 М.
Creating a Realistic BRACKEN Model for LETHAL COMPANY
17:59
Inside the V3 Nazi Super Gun
19:52
Blue Paw Print
Рет қаралды 2,3 МЛН
I Remade Star Wars VFX in 1 Week
10:39
ErikDoesVFX
Рет қаралды 2,8 МЛН
Coding Adventure: Ray Marching
5:06
Sebastian Lague
Рет қаралды 1,1 МЛН
Introducing EasyRain for Unreal Engine 5
12:40
William Faucher
Рет қаралды 144 М.
Nanite Forest Optimisation in Unreal Engine 5
21:06
Filgeck
Рет қаралды 19 М.