Rendering questions

Hi! I’m really impressed by Armory. I wanted to ask some questions about rendering stuff with it:

  • For doing shadows for things like foliage and polygon-hair (meshes that are translucent because of opacity from textures), is there a way to render them with alpha-blending to get a nice smooth edge, but then have them cast hard shadows with alpha-test (masking)? This is a game engine trick that some ppl do to get a soft-edged mesh that can still cast shadows.

  • Can you write and use custom GLSL shaders? (I guess this is what the new ‘render drivers’ are for, but what if you want to modify just one or two shaders and keep the rest as built-in.)

  • How can you include an Armature-deformed mesh into the GI calculations? This isn’t for realtime use, but more like using Armory as a fast renderer. In theory, on a frame of animation you could apply all modifiers on a character mesh so it becomes “static” and then it would cause indirect lighting on itself and the environment as well, instead of just receiving it from the environment (since all meshes would be considered as one big static environment, at the cost of slow preprocessing each frame as the meshes deform and the GI needs to be recalculated).

Here is an example of custom shaders in armory: https://github.com/armory3d/armory_examples/tree/master/material_shaders

1 Like

Hi @Simonrazer. Thank you for pointing me to that resource, it’s really useful! So it is possible to use a custom shader. That’s question #2

As for #1, after some more reading, Armory uses Iron, a graphics engine. When it draws shadows, Iron uses the “shadowmap” context.
This context is something that you can specify in your Armory material, you give the context a name and some material parameters.
So it seems that it’s possible to have one “mesh” context for standard rendering with alpha-blending, and another context named “shadowmap” which uses a shader that emulates an alpha-test (since it’s a fixed-function thing that is done with shaders now, by discarding pixels:
https://www.khronos.org/opengl/wiki/Transparency_Sorting#Alpha_test

You can see the context name in that example material:
https://github.com/armory3d/armory_examples/blob/master/material_shaders/Bundled/MyMaterial/MyMaterial.arm#L22