ospray icon indicating copy to clipboard operation
ospray copied to clipboard

Cannot wrap texture in mirrored mode

Open celime opened this issue 6 years ago • 6 comments

Is it possible to have the OpenGL GL_MIRRORED_REPEAT texture wrap mode ?

before sampling the texture: if (MIRROR_MODE) { if (int(u)&1) u=-u; if (int(v)&1) v=-v; } Thanks

celime avatar Sep 23 '18 22:09 celime

Actually OSPRay does currently not know about texture wrap modes (REPEAT is always used). The material or the renderer can use different modes by manipulating the texture-coordinates (like you wrote). For example we have an internal utility function clamp2edge.

So, what is your usecase? Would it be sufficient for you to add above code? Or do we really need a new texture property "wrap mode", similar to the texture transformations?

johguenther avatar Sep 25 '18 08:09 johguenther

I think the mirrored repeat mode have to be an internal property, because it is not possible to emulate it via the user defined textures coordinates.

For instance, with a rectangle, if 'u' go from 0.0 to 3.0, there is 3 texture repeats, but it's not possible to control the mirrored sampling method. (In fact, it is possible with others costly operations: Split the rectangle in 3 parts, or else build a new texture with four time the original size).

I think we really need a new texture property "wrap mode".

Thanks

celime avatar Sep 25 '18 11:09 celime

What I meant is changing the source code in OSPRay for yourself / for your application (I tried that this morning with the scivis renderer), not changing the model. If that's not so easy we can add that as a new feature to OSPRay.

johguenther avatar Sep 25 '18 12:09 johguenther

Yes, I will add that property in my own OSPray compiled instance. By the way, thank you very much for the nice work in the OSPray engine !

celime avatar Sep 25 '18 13:09 celime

FYI, texture wrap modes will be implemented

johguenther avatar Sep 22 '21 14:09 johguenther

FYI, texture wrap modes will be implemented

That's great news. For my application I require support for texture coordinate clamping (like OpenGL's GL_CLAMP_TO_EDGE wrap mode).

Context: I want to implement pseudo-color mapping of a scalar field defined on a rendered surface mesh. The scalar field values are associated with the mesh vertices and passed to OSPRay as UV texture coordinates (in the U component, V remains unused). A 1-d texture map containing a color gradient is used to map scalar field values to RGB colors on a per-pixel basis. Out-of-bounds field values (below 0.0/above 1.0) should be mapped to the border colors of the gradient map. This currently does not work with the wrap-around behavior of textures.

stukowski avatar Sep 24 '21 15:09 stukowski