RenderKit / ospray

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

Multitexturing #128

Closed tbiedert closed 7 years ago

tbiedert commented 7 years ago

Is multiple textures per triangle mesh support planned for the SciVis renderer? i.e. a list of textures per material, and a corresponding list of UV coordinates per vertex.

In our application we use blend over in the given texture order.

Thanks!

johguenther commented 7 years ago

Well, the short answer is "no" (there are currently no plans). Just to clarify: you really need multiple sets of texture coordinates (i.e. for the triangle mesh not only the vec2f array vertex.texcoord, but e.g. vertex.texcoord2, vertex.texcoord3, ...)? Is there a maximum number of sets? Do you use your own material to blend the textures?

tbiedert commented 7 years ago

Hi, thanks for the feedback. Theoretically, the vec2f array vertex.texcoord would suffice, because we only need 2D textures. Now I need clarification: It's currently not possible to use multiple materials for texture blending (on the same vertex/primitive), is it?

Edit: Sorry for the confusion. In my original post I meant right now in our OpenGL renderer we use the blend over operator. Thus, we would be happy about multitexturing support for our OSPRay backend.

johguenther commented 7 years ago

If one set of texture coordinates is sufficient then everything is much easier. You can already use multiple textures, e.g. with the OBJ material. But I guess you want to combine multiple textures to modify a single material property (e.g. diffuse color). This can easily be implemented in a (probably custom) material (I just see that this requires a small change to the SciVis renderer).

tbiedert commented 7 years ago

Alright, thanks! We will investigate the custom material vs. maybe prebaking a single (mega) texture.

Edit: I've got you wrong, sorry. Yes, in fact we need multiple texcoord arrays. The textures should be addressable using different UV coordinates per vertex.

johguenther commented 7 years ago

OK. One more note: sometimes it is possible to have different UV coordinates for texture fetches, all still based on the same texture coordinates per vertex, but using different texture coordinates transformations (which again can happen in the material). Transformations such as scale, shift, or rotation; and code for this is already in OSPRay.

tbiedert commented 7 years ago

Thanks, but this is only implemented in the Pathtracer, right?

johguenther commented 7 years ago

Currently, yes. But if this would be a solution for you we would change the SciVis renderer to support texture transformations as well. This is again much easier than supporting multiple UV sets (what we will still discuss internally).