K41nn
April 7, 2024, 5:48pm
1
Hello everyone. I started using Armory 3D these days and enjoyed it very much. I have a doubt about how to make soft particles. Blender 2.79 has an option called Depth Transparency, absent (or hidden) in the 3.x versions of Blender.
Reference:
Something like that.
Could someone help me?
Hey,
It might be possible in Armory using the depth buffer as a shader uniform. If you are still interested in this, let me know, I’ll try to create an example for it.
This feature was introduced here:
armory3d:master
← MoritzBrueckner:depth-texture
opened 04:36PM - 03 Apr 22 UTC
Requries https://github.com/armory3d/iron/pull/160.
This PR implements what w… as discussed in https://github.com/armory3d/armory/pull/1817. Materials now can specify that they want to read from the depth buffer. In this case, meshes with those materials are drawn last and before they are drawn, the depth buffer is copied to a dedicated depth texture that can then be sampled from a shader uniform called `depthtex`.
![Material UI](https://user-images.githubusercontent.com/17685000/161437565-f9f00e61-ad36-4990-85e9-6856d7937b86.png)
![depthtex](https://user-images.githubusercontent.com/17685000/161437419-15459c24-f84c-4225-9a79-eb44a53af26e.gif)
It works on deferred and forward (Depth prepass on/off), with shadows and transparency, SSR and mesh batching. The only limitation I know is that on forward RP this doesn't work when the compositor is turned off because then the `rp_render_to_texture` define is undefined and `lbuffer0` does not exist. I'm not sure whether this define should only be set for the compositor (as it also creates some other render targets for example) or whether it can be enabled for this feature as well. In general it's difficult to see what rendertargets and defines are used for what purpose, so please let me know if I should change something. Btw, what does the `l` in `lbuffer0` stand for?
Tested on:
- Krom on Windows
- html5
- Hl/C on both OpenGL and D3D11 on Windows
The entire depth texture feature can be toggled on or off in the renderpath settings:
![depthtex_menu](https://user-images.githubusercontent.com/17685000/161437429-115ecdac-de9c-47f1-a95e-33f9067ed0cc.png)
My next goal is to implement the possibility to allow defining samplers/texture units in custom materials via the UI (because they are defined in the mat data .json and not in the shader .json that the user can provide; also Khamake needs to know about the textures). Then it would be possible for example to create an underwater caustics volume together with the depth read feature.
K41nn
July 8, 2024, 7:42pm
4
Thanks for reply.
If you make an example I would greatly appreciate it. Sorry for the delay in responding, I was without a computer.