RenderKit / ospray

An Open, Scalable, Portable, Ray Tracing Based Rendering Engine for High-Fidelity Visualization
http://ospray.org
Apache License 2.0
1.01k stars 182 forks source link

Mix material with a luminous material inside. #548

Open g-step opened 1 year ago

g-step commented 1 year ago

Hi,

I am trying to build a mix material by combining two luminous materials. The mix material works flawlessly when I use standard materials, I can see them being mixed based on the texture assigned to "map_factor"  parameter. However, when I plug a luminous material into the mix the renderer throws an access violation exception.

Here is a sample:

ospray::cpp::Material lum1("pathtracer", "luminous");
lum1.setParam("intensity", 1.0f);
lum1.setParam("color", vec3f(0.0f, 1.0f, 0.0f));
lum1.commit();
ospray::cpp::Material lum2("pathtracer", "luminous");
lum2.setParam("intensity", 0.0f);
lum2.setParam("color", vec3f(0.0f, 0.0f, 1.0f));
lum2.commit();

ospray::cpp::Material mix("pathtracer", "mix");
mix.setParam("factor", 0.5f);
//mix.setParam("map_factor", mask_texture);
mix.setParam("material1", lum1);
mix.setParam("material2", lum2);
mix.commit();

Any ideas on how to make a partially luminous material?

johguenther commented 1 year ago

Unfortunately support for Luminous in the MixMaterial is currently buggy. Actually, the whole MixMaterial is an unofficial feature (no documentation and also no testing).

It looks like you are mainly interested in texturing the emission. This will be slow with Mix in any case, we rather like to extend Lumious (and Principled) to directly support a texture for emission; a prototype exists, but finishing this will still take some time.

johguenther commented 8 months ago

Texture support for Luminous comes with the next release.

g-step commented 8 months ago

Great news, thanks!

johguenther commented 7 months ago

96e96d3943e0f3527f2b4565433f7432868b4eaf added texture support for Luminous and 9c3aa5e21b1a0e8690ffd4ff5fe5e9d455851ae5 improved the Mix material regarding textured emission (though still not perfect).