Difference between revisions of "GPU/Procedural Texture Generation"

From 3dbrew
< GPU
Jump to navigation Jump to search
(Hey, look what I found... (thanks @ yuriks for translating!))
 
m
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The 3DS GPU supports procedural generation of texture data using [[GPU_Textures|texture unit 3]]. Little is known about this feature, albeit a few public hints have been dropped. The contents of this page are solely based on reports on a [http://www.4gamer.net/games/017/G001762/20120822007/ presentation] given by DMP.
+
[[Category:GPU]]
 +
The 3DS GPU supports procedural generation of texture data using [[GPU/Internal_Registers#GPUREG_TEXUNIT3_PROCTEX0|texture unit 3]]. Little is known about this feature, albeit a few public hints have been dropped. The contents of this page are solely based on reports on a [http://www.4gamer.net/games/017/G001762/20120822007/ presentation] given by DMP.
 +
 
 +
The related GPU registers can be found starting [[GPU/Internal_Registers#GPUREG_TEXUNIT3_PROCTEX0|here]].
  
 
== Overview ==
 
== Overview ==
 
Procedural texture generation has four stages:
 
Procedural texture generation has four stages:
* Noise Module
+
* Noise Module (outputs u&prime;,v&prime;)
* Repeat Module
+
* Repeat Module (outputs u&prime;&prime;,v&prime;&prime;)
* Base Shape
+
* Base Shape (also notated as G(u&prime;&prime;,v&prime;&prime;), output g)
 
* F(g) and Lookup Table
 
* F(g) and Lookup Table
  
 
== Noise Module ==
 
== Noise Module ==
 
This stage applies noise on the input coordinates. Little is known about this other than that there are three noise parameters:
 
This stage applies noise on the input coordinates. Little is known about this other than that there are three noise parameters:
* Turbulence (?)
+
* Amplitude
 
* Frequency
 
* Frequency
 
* Phase
 
* Phase
 +
 +
These parameters are configured starting [[GPU/Internal_Registers#GPUREG_TEXUNIT3_PROCTEX1|here]].
  
 
== Repeat Module ==
 
== Repeat Module ==
Line 19: Line 24:
 
== Base Shape ==
 
== Base Shape ==
  
The U&rsquo;&rsquo; and V&rsquo;&rsquo; coordinates are used to generate a scalar value in the range [0;1] from the wrapped coordinates using one of six functions:
+
The U&rsquo;&rsquo; and V&rsquo;&rsquo; coordinates are used to generate a scalar value in the range [0;1] from the wrapped coordinates using one of six functions documented [[GPU/Internal_Registers#GPUREG_TEXUNIT3_PROCTEX0|here]].
* ADDSQRT2: sqrt(U&rsquo;&rsquo;*U&rsquo;&rsquo;+V&rsquo;&rsquo;*V&rsquo;&rsquo;) (?)
 
* U&rsquo;&rsquo;: U&rsquo;&rsquo; (discards V&rsquo;&rsquo;)
 
* V&rsquo;&rsquo;: V&rsquo;&rsquo; (discards U&rsquo;&rsquo;)
 
* MIN: min(U&rsquo;&rsquo;,V&rsquo;&rsquo;)
 
* MAX: min(U&rsquo;&rsquo;,V&rsquo;&rsquo;)
 
* ADD: U&rsquo;&rsquo;+V&rsquo;&rsquo;
 
  
 
The output of this function is named "g".
 
The output of this function is named "g".
Line 35: Line 34:
 
* a triangle function
 
* a triangle function
  
The final texel color is determined by using the value of F(g) as an index into a configurable lookup table.
+
The final texel color is determined by using the value of F(g) as an index into a configurable [[GPU/Internal_Registers#GPUREG_PROCTEX_LUT|lookup table]].

Latest revision as of 08:23, 5 December 2015

The 3DS GPU supports procedural generation of texture data using texture unit 3. Little is known about this feature, albeit a few public hints have been dropped. The contents of this page are solely based on reports on a presentation given by DMP.

The related GPU registers can be found starting here.

Overview[edit]

Procedural texture generation has four stages:

  • Noise Module (outputs u′,v′)
  • Repeat Module (outputs u′′,v′′)
  • Base Shape (also notated as G(u′′,v′′), output g)
  • F(g) and Lookup Table

Noise Module[edit]

This stage applies noise on the input coordinates. Little is known about this other than that there are three noise parameters:

  • Amplitude
  • Frequency
  • Phase

These parameters are configured starting here.

Repeat Module[edit]

This stage performs basic texture coordinate wrapping on the noised coordinates. It supports symmetric and mirrored wrapping. They don't seem to be configurable beyond that.

Base Shape[edit]

The U’’ and V’’ coordinates are used to generate a scalar value in the range [0;1] from the wrapped coordinates using one of six functions documented here.

The output of this function is named "g".

F(g) and Lookup Table[edit]

F is a selectable function which transforms g to another scalar value. There are two known options for F:

  • the identity function
  • a triangle function

The final texel color is determined by using the value of F(g) as an index into a configurable lookup table.