Urho3D Wiki
mNo edit summary
Tags: Visual edit apiedit
Tag: Visual edit
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
  +
<gallery>
[[File:Urho Blender seamless procedural material-0.jpg|none|thumb|400x400px]]
+
Urho Blender seamless procedural material.jpg
  +
Urho Blender seamless procedural material bricks.jpg
  +
</gallery>
 
This article shows how to use a 4 dimensional noise in Blender to create seamless textures. This works by simulating a [https://en.wikipedia.org/wiki/Clifford_torus Clifford_torus] and is inspired by these articles:
 
This article shows how to use a 4 dimensional noise in Blender to create seamless textures. This works by simulating a [https://en.wikipedia.org/wiki/Clifford_torus Clifford_torus] and is inspired by these articles:
 
* http://www.gamedev.net/blog/33/entry-2138456-seamless-noise/
 
* http://www.gamedev.net/blog/33/entry-2138456-seamless-noise/
* http://opengameart.org/forumtopic/seamlessly-tiled-procedural-texture-generation.
+
* http://opengameart.org/forumtopic/seamlessly-tiled-procedural-texture-generation
   
 
This is done with the Cycles renderer, the node editor and the Open Shading Language (OSL) feature.
 
This is done with the Cycles renderer, the node editor and the Open Shading Language (OSL) feature.
  +
  +
'''Note:''' OSL seems to also have a "periodic" noise function called "pnoise" which should be seamless (I guess), but it doesn't seem to be working at all in Blender. It is not seamless and the input seems to be quite ignored...
   
 
You can download the Blender file here: http://files.gawag.org/Seamless_Procedural_Textures4.blend. After opening the file with Blender you should see this (it's created with Blender 1.73a):
 
You can download the Blender file here: http://files.gawag.org/Seamless_Procedural_Textures4.blend. After opening the file with Blender you should see this (it's created with Blender 1.73a):
Line 19: Line 24:
 
[[File:Urho Blender seamless procedural material.jpg|none|thumb|400x400px]]This material in Urho3D. Diffuse and normal map:
 
[[File:Urho Blender seamless procedural material.jpg|none|thumb|400x400px]]This material in Urho3D. Diffuse and normal map:
 
<gallery>
 
<gallery>
Blender diff.jpg
+
Blender diff-0.jpg
Blender norm.jpg
+
Blender norm-0.jpg
 
</gallery>
 
</gallery>
[[File:Blender norm-0.jpg|thumb|220x220px]]
 
[[File:Blender diff-0.jpg|thumb|220x220px]]
 
   
 
Urho material file:
 
Urho material file:
Line 48: Line 51:
 
<material><br> <technique name="Techniques/DiffNormalSpec.xml"/><br> <texture name="Textures/blender_bricks_diff.jpg" unit="diffuse"/><br> <texture name="Textures/blender_bricks_norm.jpg" unit="normal"/>
 
<material><br> <technique name="Techniques/DiffNormalSpec.xml"/><br> <texture name="Textures/blender_bricks_diff.jpg" unit="diffuse"/><br> <texture name="Textures/blender_bricks_norm.jpg" unit="normal"/>
 
<texture name="Textures/blender_bricks_spec.jpg" unit="specular"/><br> <parameter name="MatDiffColor" value="1.0 1.0 1.0 1"/><br> <parameter name="MatSpecColor" value="2.5 2.5 2.5 30"/><br></material>
 
<texture name="Textures/blender_bricks_spec.jpg" unit="specular"/><br> <parameter name="MatDiffColor" value="1.0 1.0 1.0 1"/><br> <parameter name="MatSpecColor" value="2.5 2.5 2.5 30"/><br></material>
  +
  +
==== Bricks as a "[[Quad Textures|Quad Texture]]" ====
  +
[[File:Urho quad texture.jpg|none|thumb|400x400px]]
  +
This Blender project is similar to the one before. But the different textures are now in one big image (this makes creating the textures in Blender much more convenient):
 
[[File:Blender bricks quad.jpg|none|thumb|400x400px]]
  +
Diffuse, normal, specular and height map. The height map can be used for parallax mapping or for [[Height Mapping|height mapping]]. This quad material requires a special shader, see [[Quad Textures|Quad Texture]] and [[Terrain Shader with normal, specular and height mapping]].
  +
  +
The Blender file can be got here: [http://files.gawag.org/Seamless_Procedural_Textures_tiles3.blend http://files.gawag.org/Seamless_Procedural_Textures_tiles_quad3.blend]
  +
  +
'''Note:''' Using such a texture may result in sampling issues resulting in black stripes like these:
  +
[[File:Urho quad stripes.jpg|none|thumb|400x400px]]
  +
To avoid this you can use a custom shader and a texture like this:
 
[[File:Blender bricks quad-0.jpg|none|thumb|400x400px]]
  +
See also [[Quad Textures|Quad Texture]] and [[Terrain Shader with normal, specular and height mapping]] for more explanations.
  +
  +
Here are three Blender files which create such images:
  +
* https://github.com/gawag/Urho_Material_Test/blob/046d9fd50fc1fb11ed6d3274fc7f66f975fb5bef/blends/Seamless_Procedural_Textures_grass_quad3.blend?raw=true
  +
* https://github.com/gawag/Urho_Material_Test/blob/046d9fd50fc1fb11ed6d3274fc7f66f975fb5bef/blends/Seamless_Procedural_Textures_tiles_quad4.blend?raw=true
  +
* https://github.com/gawag/Urho_Material_Test/blob/046d9fd50fc1fb11ed6d3274fc7f66f975fb5bef/blends/Seamless_Procedural_Textures_sand_quad1.blend?raw=true
  +
The created images are the three on the right side of this image:
  +
[[File:Urho_Terrain_Quad_Images.jpg|thumb|center|500px]]

Revision as of 23:25, 5 January 2020

This article shows how to use a 4 dimensional noise in Blender to create seamless textures. This works by simulating a Clifford_torus and is inspired by these articles:

This is done with the Cycles renderer, the node editor and the Open Shading Language (OSL) feature.

Note: OSL seems to also have a "periodic" noise function called "pnoise" which should be seamless (I guess), but it doesn't seem to be working at all in Blender. It is not seamless and the input seems to be quite ignored...

You can download the Blender file here: http://files.gawag.org/Seamless_Procedural_Textures4.blend. After opening the file with Blender you should see this (it's created with Blender 1.73a):

Blender seamless texture-0

The node editor in the lower left shows the "procedural_material" material. It uses a "seamless_noise" node group to generate a noise (this group is used twice, see the left two nodes) and then creates a normal and a diffuse map out of it. There are some node frames with short explanations to describe the different sections.

The node group consists of mainly three parts: UV to 4D special shape transformation, a 4D noise generator using OpenShadingLanguage (see text editor in the top left) and a RGB to grey converted as the noise is colored at first (which could be also useful to generate material). Node groups can be entered using tab.

There are two output nodes on the right side, the upper one is for the normal map and the lower one for the diffuse map. Currently the upper one is the active one (simply click on the one to activate) and therefore the 3D window on the right shows the diffuse map on the 4x4 field of planes. The view is automatically updated when something in the node editor is changed.

Press F12 to render the texture, it can be saved from there. There is an orthogonal camera above a single plane that is capturing the whole seamless texture.

Examples for in Blender generated diffuse and normal map with this method

Urho Blender seamless procedural material

This material in Urho3D. Diffuse and normal map:

Urho material file:

<material>
<technique name="Techniques/DiffNormal.xml"/>
<texture name="Textures/blender_diff.png" unit="diffuse"/>
<texture name="Textures/blender_norm.png" unit="normal"/>
<parameter name="MatDiffColor" value="1.0 1.0 1.0 1"/>
<parameter name="MatSpecColor" value="2.5 2.5 2.5 30"/>
</material>

Bricks

Urho Blender seamless procedural material bricks

This material in Urho3D. Diffuse, normal and specular map:

Blender seamless texture bricks

This material is made similar to the brick material made with NeoTextureEdit to see if Blender can be a full alternative: It's quite close, but there is no blur.

The Blender file can be got here: http://files.gawag.org/Seamless_Procedural_Textures_tiles3.blend

The noise node group has been modified to also export the colored noise which is used to distort the generated brick pattern. A brick pattern shader has been written to get a brick pattern with softer edges as Blender's own brick pattern has.

Urho material file:

<material>
<technique name="Techniques/DiffNormalSpec.xml"/>
<texture name="Textures/blender_bricks_diff.jpg" unit="diffuse"/>
<texture name="Textures/blender_bricks_norm.jpg" unit="normal"/> <texture name="Textures/blender_bricks_spec.jpg" unit="specular"/>
<parameter name="MatDiffColor" value="1.0 1.0 1.0 1"/>
<parameter name="MatSpecColor" value="2.5 2.5 2.5 30"/>
</material>

Bricks as a "Quad Texture"

Urho quad texture

This Blender project is similar to the one before. But the different textures are now in one big image (this makes creating the textures in Blender much more convenient):

Blender bricks quad

Diffuse, normal, specular and height map. The height map can be used for parallax mapping or for height mapping. This quad material requires a special shader, see Quad Texture and Terrain Shader with normal, specular and height mapping.

The Blender file can be got here: http://files.gawag.org/Seamless_Procedural_Textures_tiles_quad3.blend

Note: Using such a texture may result in sampling issues resulting in black stripes like these:

Urho quad stripes

To avoid this you can use a custom shader and a texture like this:

Blender bricks quad-0

See also Quad Texture and Terrain Shader with normal, specular and height mapping for more explanations.

Here are three Blender files which create such images:

The created images are the three on the right side of this image:

Urho Terrain Quad Images