<p>I am considering using octahedron textures for environment mapping, opposed to sphere or cube mapping due to their low memory footprint and the quality they result in.</p>
<p>Is there a possibility to render to such an octahedron texture directly (i.e. 3D -&gt; Octahedron)?
<a href="https://i.sstatic.net/4sLDo.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4sLDo.png" alt="enter image description here" /></a>
Rendering to a cubemap and then to the octahedron is fairly straight forward since I can use the Octahedron Texture Coordinates to retrieve the cubemap direction for sampling.
But I would like to skip the intermediate cubemap. The octahedron textures are supposed to be generated at load time behind a loading screen.</p>

CC BY-SA 4.0
2023-08-03T08:49:52.703Z
I'm not 100% sure, but I think you can do.... **Step 1:** create a framebuffer where your texture array is attached to (one layer for each triangle in your image). **Step 2:** create a shader program with geometry shader where the geometry shader duplicates the rendered geometry 8 times and bring these to the 8 layers of your texture. Also apply the rotation matrix of the response triangle. **Step 3:** add clipping planes for each layer. Here you need 3 clipping planes for each of the 8 triangles (at least 1 clipping plane for the diagonal edge).
Thomas
CC BY-SA 4.0
2023-08-03T08:52:14.680Z
Again not sure if this works... Trying to do it with viewport array... each viewport will be set to the reagion of a triangle in your final image... I never used viewport arrays before so I'm not sure if this works out
Thomas
CC BY-SA 4.0
2023-08-03T08:53:40.107Z
have in mind, that geometry shaders will slow down the rendering process... So not sure if you realy want to do so
Thomas
<rendering><projections>
Is it possible to render to a octahedron texture directly?
Raildex
# Is it possible to render to a octahedron texture directly?

(Asked by: username_0 on 2023-08-02)

I am considering using octahedron textures for environment mapping, opposed to sphere or cube mapping due to their low memory footprint and the quality they result in.

Is there a possibility to render to such an octahedron texture directly (i.e. 3D -> Octahedron)?
[![enter image description here](https://i.sstatic.net/4sLDo.png)](https://i.sstatic.net/4sLDo.png)
Rendering to a cubemap and then to the octahedron is fairly straight forward since I can use the Octahedron Texture Coordinates to retrieve the cubemap direction for sampling.
But I would like to skip the intermediate cubemap. The octahedron textures are supposed to be generated at load time behind a loading screen.

**Tags:** rendering, projections

> **Comments:**
> **username_1**: I'm not 100% sure, but I think you can do.... **Step 1:** create a framebuffer where your texture array is attached to (one layer for each triangle in your image). **Step 2:** create a shader program with geometry shader where the geometry shader duplicates the rendered geometry 8 times and bring these to the 8 layers of your texture. Also apply the rotation matrix of the response triangle. **Step 3:** add clipping planes for each layer. Here you need 3 clipping planes for each of the 8 triangles (at least 1 clipping plane for the diagonal edge).  
> **username_1**: Again not sure if this works... Trying to do it with viewport array... each viewport will be set to the reagion of a triangle in your final image... I never used viewport arrays before so I'm not sure if this works out  
> **username_1**: have in mind, that geometry shaders will slow down the rendering process... So not sure if you realy want to do so  

---

## 0 answers

