# Convert 2D material to a 3D "object"?

**URL:** <https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133>\
**Category:** Community & Industry Discussion\
**Tags:** unreal-engine, UE4-27, question\
**Created:** [February 15, 2022, 2:40am UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133 "2022-02-15T02:40:42Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinortiz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@martinortiz](https://forums.unrealengine.com/u/martinortiz)\
**Post date:** [February 15, 2022, 2:40am UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133/1 "2022-02-15T02:40:42Z")

</div>

I am playing with some fractals…

Now I can make a 2D material, that displays the fractal using custom HLSL shader.  
The fractal is “3D” ish. Of course, displayed on a 2D material.

Is there a way to make it into a 3D “object” in the scene?  
Hope question makes sense.

---

<div class="post-metadata">

**Author:** ![martinortiz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@martinortiz](https://forums.unrealengine.com/u/martinortiz)\
**Post date:** [February 15, 2022, 2:54am UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133/2 "2022-02-15T02:54:11Z")

</div>

For example…  
This is just a made up example…but it is similar.  
Say I have a shader that displays the solar system and planets rotating around the sun.  
I can create a custom HLSL node and make a material that displays it.  
But it is being displayed on a 2D surface.  
How do I make it so it exists in the 3D world of the scene itself?  
So that I can have my character walk around it?

---

<div class="post-metadata">

**Author:** ![HAF-Blade](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/haf-blade/32/88718_2.png) [@HAF-Blade](https://forums.unrealengine.com/u/HAF-Blade)\
**Post date:** [February 15, 2022, 5:58am UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133/5 "2022-02-15T05:58:46Z")

</div>

Inform yourself about normal maps, height maps, bump maps and tesselation. This could help.

---

<div class="post-metadata">

**Author:** ![MingYueMeow](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MingYueMeow](https://forums.unrealengine.com/u/MingYueMeow)\
**Post date:** [February 15, 2022, 6:13am UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133/6 "2022-02-15T06:13:25Z")

</div>

Calculate a offset in world space and wire it into World Position Offset.

---

<div class="post-metadata">

**Author:** ![martinortiz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@martinortiz](https://forums.unrealengine.com/u/martinortiz)\
**Post date:** [February 15, 2022, 3:35pm UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133/7 "2022-02-15T15:35:14Z")

</div>

Height maps and bump maps won’t work for what I’m after.

Modifying World Position Offset, will change the position of the whole surface/mesh.

---

<div class="post-metadata">

**Author:** ![martinortiz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@martinortiz](https://forums.unrealengine.com/u/martinortiz)\
**Post date:** [February 15, 2022, 3:38pm UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133/8 "2022-02-15T15:38:36Z")

</div>

Another example…  
Say I have a shader…  
It displays a 3D cube, the cube morphs back and forth between a 3D cube and a 3D sphere.  
Now I can make a custom HLSL shader/material, with that shader.  
It will display the object morphing back and forth between cube/sphere on the 2D surface (if it’s a plane).

I want the shader to display this effect in the 3D space of the scene…

---

<div class="post-metadata">

**Author:** ![verdyss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/verdyss/32/268031_2.png) [@verdyss](https://forums.unrealengine.com/u/verdyss)\
**Post date:** [February 15, 2022, 4:18pm UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133/9 "2022-02-15T16:18:14Z")

</div>

Look into “procedural generation” of meshes, there’s an example in the Content Examples iirc. You can write C++ code or draw Blueprints that create model geometry you can place as static meshes within levels and walk around etc [Procedural Mesh | Unreal Engine Documentation](https://docs.unrealengine.com/4.27/en-US/BlueprintAPI/Components/ProceduralMesh/)

Very basic example which just creates a single triangle [Jan Wlosok | Procedural Mesh in UE4 #1 – Triangle](http://wlosok.cz/procedural-mesh-in-ue4-1-triangle/)  
…then like, add more triangles to create your menger sponge or snowflake mandelbulb or whatever

---

<div class="post-metadata">

**Author:** ![martinortiz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@martinortiz](https://forums.unrealengine.com/u/martinortiz)\
**Post date:** [February 15, 2022, 6:53pm UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133/10 "2022-02-15T18:53:47Z")

</div>

I have heard of procedural meshes…etc…but that is a whole other beast.  
I will eventually look into that for other stuff.

---

<div class="post-metadata">

**Author:** ![martinortiz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@martinortiz](https://forums.unrealengine.com/u/martinortiz)\
**Post date:** [February 15, 2022, 7:00pm UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133/11 "2022-02-15T19:00:43Z")

</div>

Here is an example shader I got working in Unreal

 ![preview](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/8/a/48ad4ebad46bee57d4c7f1c65f8f059ec39a1dd8.jpeg)

It’s very nice looking, I made a material of it.

 ![demo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/3/0/230c3d37707f12259071aba98bcb1000c7a98b1f.jpeg)

It is animated, not just an image…of writhing “tentacles”.  
It’s a material on a cube object…

I don’t think this could be ported and made a procedural mesh.  
That is, without starting completely from scratch, not using a shader at all.

---

<div class="post-metadata">

**Author:** ![martinortiz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@martinortiz](https://forums.unrealengine.com/u/martinortiz)\
**Post date:** [February 15, 2022, 7:02pm UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133/12 "2022-02-15T19:02:54Z")

</div>

What would be cool…  
Is to make those writhing tentacles a 3D entity(not a mesh per say) in the scene…  
This seems to a more difficult task than I thought it would be.

---

<div class="post-metadata">

**Author:** ![verdyss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/verdyss/32/268031_2.png) [@verdyss](https://forums.unrealengine.com/u/verdyss)\
**Post date:** [February 15, 2022, 7:08pm UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133/13 "2022-02-15T19:08:17Z")

</div>

I think you might be able to do that using the Niagara particle system, it’s meant for making like lightning bolts or fog clouds or swarms of insects out of lots of flat semitransparent images laid on top of each other.

---

<div class="post-metadata">

**Author:** ![martinortiz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@martinortiz](https://forums.unrealengine.com/u/martinortiz)\
**Post date:** [February 15, 2022, 7:41pm UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133/14 "2022-02-15T19:41:48Z")

</div>

Here is what my imaginary process would look like…  
Whether needing to use a particle system or not, is another issue…probably it would be needed.

Have two materials

1. One HLSL material, that simply creates the “3D entity” (contains pixel colors)
2. Uses shader in #1 but outputs not a color, but the z-buffer information.
3. Use the pixel color values in #1, and the z-buffer values in #2, to create a 3D entity in the scene.  
Perhaps create tiny sprite particles from #3 to create the 3D entity.

---

<div class="post-metadata">

**Author:** ![martinortiz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@martinortiz](https://forums.unrealengine.com/u/martinortiz)\
**Post date:** [February 15, 2022, 7:44pm UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133/15 "2022-02-15T19:44:38Z")

</div>

Now I don’t know if HLSL shaders in general use a z-value.  
So if you are computing the color at pixel.xyz, you might not even use a z value.

---

<div class="post-metadata">

**Author:** ![martinortiz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@martinortiz](https://forums.unrealengine.com/u/martinortiz)\
**Post date:** [February 15, 2022, 9:22pm UTC](https://forums.unrealengine.com/t/convert-2d-material-to-a-3d-object/498133/16 "2022-02-15T21:22:31Z")

</div>

This sounds exactly like what I’m looking for, but it is in Unity3D.

[https://www.alanzucconi.com/2016/07/01/volumetric-rendering/](https://www.alanzucconi.com/2016/07/01/volumetric-rendering/)
