<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.stephanschlegel.de/index.php?action=history&amp;feed=atom&amp;title=Three.js_-_materials</id>
	<title>Three.js - materials - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.stephanschlegel.de/index.php?action=history&amp;feed=atom&amp;title=Three.js_-_materials"/>
	<link rel="alternate" type="text/html" href="https://wiki.stephanschlegel.de/index.php?title=Three.js_-_materials&amp;action=history"/>
	<updated>2026-05-06T22:45:20Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Wikizone</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.stephanschlegel.de/index.php?title=Three.js_-_materials&amp;diff=25612&amp;oldid=prev</id>
		<title>134.3.241.3 am 28. Dezember 2021 um 18:21 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.stephanschlegel.de/index.php?title=Three.js_-_materials&amp;diff=25612&amp;oldid=prev"/>
		<updated>2021-12-28T18:21:47Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 28. Dezember 2021, 18:21 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ThreeJs &lt;/del&gt;- Snippets]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;ThreeJS &lt;/ins&gt;- Snippets]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Besonders wichtig für realistische Ergebnisse ist das MeshStandardMaterial. Siehe unten.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Besonders wichtig für realistische Ergebnisse ist das MeshStandardMaterial. Siehe unten.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>134.3.241.3</name></author>
	</entry>
	<entry>
		<id>https://wiki.stephanschlegel.de/index.php?title=Three.js_-_materials&amp;diff=25611&amp;oldid=prev</id>
		<title>134.3.241.3: Die Seite wurde neu angelegt: „ThreeJs - Snippets  Besonders wichtig für realistische Ergebnisse ist das MeshStandardMaterial. Siehe unten. === MeshBasicMaterial === &lt;syntaxhighlight la…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.stephanschlegel.de/index.php?title=Three.js_-_materials&amp;diff=25611&amp;oldid=prev"/>
		<updated>2021-12-28T18:21:32Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „&lt;a href=&quot;/index.php?title=ThreeJs_-_Snippets&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;ThreeJs - Snippets (Seite nicht vorhanden)&quot;&gt;ThreeJs - Snippets&lt;/a&gt;  Besonders wichtig für realistische Ergebnisse ist das MeshStandardMaterial. Siehe unten. === MeshBasicMaterial === &amp;lt;syntaxhighlight la…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[ThreeJs - Snippets]]&lt;br /&gt;
&lt;br /&gt;
Besonders wichtig für realistische Ergebnisse ist das MeshStandardMaterial. Siehe unten.&lt;br /&gt;
=== MeshBasicMaterial ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
const material = new THREE.MeshBasicMaterial()&lt;br /&gt;
material.color.set(0xaabb00)&lt;br /&gt;
material.map = doorColorTexture&lt;br /&gt;
material.side = DoubleSide&lt;br /&gt;
material.wireframe = true&lt;br /&gt;
material.transparent = true&lt;br /&gt;
material.opacity = 0.5&lt;br /&gt;
material.alphaMap = doorAlphaTexture&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Komplexere Materialien haben natürlich weitere Eigenschaften&lt;br /&gt;
=== MeshNormalMaterial ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// normally to debug normals&lt;br /&gt;
const material = new THREE.MeshNormalMaterial()&lt;br /&gt;
material.flatShading = true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MeshMatcapMaterial ===&lt;br /&gt;
 https://github.com/nidorx/matcaps - gute Quelle&lt;br /&gt;
MeshMatcapMaterial is a fantastic material because of how great it can look while being very performant.&lt;br /&gt;
* Performant&lt;br /&gt;
* simuliert Licht ohne Lichtquelle&lt;br /&gt;
* gut für&amp;#039;s Modelling&lt;br /&gt;
&lt;br /&gt;
For it to work, the MeshMatcapMaterial &amp;#039;&amp;#039;&amp;#039;needs a reference texture that looks like a sphere&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
The material will then pick colors on the texture according to the normal orientation relative to the camera.&lt;br /&gt;
To set that reference matcap texture, use the matcap property. For it to work, the MeshMatcapMaterial needs a reference &amp;#039;&amp;#039;&amp;#039;texture that looks like a sphere&amp;#039;&amp;#039;&amp;#039;. The material will then pick colors on the texture according to the normal orientation relative to the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// MATCAP&lt;br /&gt;
const material = new THREE.MeshMatcapMaterial()&lt;br /&gt;
material.matcap = matcapTexture&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MeshDepthMaterial ===&lt;br /&gt;
Nahe Bereiche werden hell, ferne dunkel gerendert. Kann man z.B. für Camera Tests oder für Nebel nutzen&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// DEPTH&lt;br /&gt;
const material = new THREE.MeshDepthMaterial()&lt;br /&gt;
material.transparent = true&lt;br /&gt;
material.opacity = 0.8&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MeshLambertMaterial ===&lt;br /&gt;
* Benötigt / Reagiert mit Licht&lt;br /&gt;
* Performant&lt;br /&gt;
* Ergibt manchmal Linien-Artefakte in der Geometrie&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// LAMBERT (reacts to light)&lt;br /&gt;
const material = new THREE.MeshLambertMaterial()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MeshPhongMaterial ===&lt;br /&gt;
Ähnlich wie Lambert.&lt;br /&gt;
* Keine Artefakte&lt;br /&gt;
* Weniger Performant&lt;br /&gt;
* Erlaubt auch Lichtreflexion nicht nur Schattierung&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// PHONG&lt;br /&gt;
const material = new THREE.MeshPhongMaterial&lt;br /&gt;
material.color.set(0xddeeee) // Grundfarbe&lt;br /&gt;
material.shininess = 180 // Glanz&lt;br /&gt;
material.specular = new THREE.Color(0x0066ff) // Glanzlichtfarbe&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MeshToonMaterial ===&lt;br /&gt;
Reduziert die Farbverläufe und erzeugt dadurch einen Cartoonartigen Effekt. &lt;br /&gt;
&lt;br /&gt;
Man kann einen Gradienten (Pixellinie mit verschiedenen Graustufen) übergeben, der dann für die Schattierungen verwendet wird. Dann sollte man allerdings den NearestFilter verwenden, damit der Standardfilter die Abstufungen beim Mipmapping nicht kaputt macht.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
const gradientTexture = textureLoader.load(&amp;#039;textures/gradients/3.jpg&amp;#039;)&lt;br /&gt;
gradientTexture.generateMipmaps = false &lt;br /&gt;
gradientTexture.minFilter = THREE.NearestFilter&lt;br /&gt;
gradientTexture.magFilter = THREE.NearestFilter&lt;br /&gt;
&lt;br /&gt;
// TOON&lt;br /&gt;
const material = new THREE.MeshToonMaterial()&lt;br /&gt;
material.gradientMap = gradientTexture&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MeshStandardMaterial ===&lt;br /&gt;
Das wahrscheinlich am meisten verwendete Material, vor allem wenn es um realistische Renders geht. Es ist ein PBR Material und unterstützt entsprechende Parameter. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Besserer Algorithmus zur Lichtberechnung als Phong oder Lambert&lt;br /&gt;
* Physic Based Rendering (PBR) Material&lt;br /&gt;
* Unterstützt PBR Parameter wie metalness oder roughness&lt;br /&gt;
* Ergibt ähnliche Ergebnisse wie in Blender etc. wenn man dort die gleichen PBR Materialien nutzt.&lt;br /&gt;
&lt;br /&gt;
Manche der Maps benötigen Tweaks bei den Objekten (siehe Kommentare)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// TEXTURES&lt;br /&gt;
const textureLoader = new THREE.TextureLoader()&lt;br /&gt;
const doorColorTexture = textureLoader.load(&amp;#039;textures/door/color.jpg&amp;#039;)&lt;br /&gt;
const doorAlphaTexture = textureLoader.load(&amp;#039;textures/door/alpha.jpg&amp;#039;)&lt;br /&gt;
const doorAmbientOcclusionTexture = textureLoader.load(&amp;#039;textures/door/ambientOcclusion.jpg&amp;#039;)&lt;br /&gt;
const doorHeightTexture = textureLoader.load(&amp;#039;textures/door/height.jpg&amp;#039;)&lt;br /&gt;
const doorMetalnessTexture = textureLoader.load(&amp;#039;textures/door/metalness.jpg&amp;#039;)&lt;br /&gt;
const doorNormalTexture = textureLoader.load(&amp;#039;textures/door/normal.jpg&amp;#039;)&lt;br /&gt;
const doorRoughnessTexture = textureLoader.load(&amp;#039;textures/door/roughness.jpg&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
// STANDARD MATERIAL&lt;br /&gt;
const material = new THREE.MeshStandardMaterial()&lt;br /&gt;
material.side = DoubleSide&lt;br /&gt;
material.map = doorColorTexture&lt;br /&gt;
&lt;br /&gt;
material.roughness = 1 // default&lt;br /&gt;
material.roughnessMap = doorRoughnessTexture&lt;br /&gt;
&lt;br /&gt;
material.metalness = 0 // default&lt;br /&gt;
material.metalnessMap = doorMetalnessTexture&lt;br /&gt;
&lt;br /&gt;
material.aoMap = doorAmbientOcclusionTexture&lt;br /&gt;
material.aoMapIntensity = 1.1&lt;br /&gt;
&lt;br /&gt;
material.displacementMap = doorHeightTexture&lt;br /&gt;
material.displacementScale = 0.03&lt;br /&gt;
&lt;br /&gt;
material.normalMap = doorNormalTexture&lt;br /&gt;
material.normalScale.set(0.5,0.5)&lt;br /&gt;
&lt;br /&gt;
material.transparent = true // needed for alpha to work&lt;br /&gt;
material.alphaMap = doorAlphaTexture&lt;br /&gt;
&lt;br /&gt;
// OBJECTS&lt;br /&gt;
const plane = new THREE.Mesh(&lt;br /&gt;
    new THREE.PlaneGeometry(1,1,100,100), // subdivisions needed for height map&lt;br /&gt;
    material&lt;br /&gt;
)&lt;br /&gt;
// copy uv coordinates to uv2 attribute needed by aomap&lt;br /&gt;
plane.geometry.setAttribute(&lt;br /&gt;
    &amp;#039;uv2&amp;#039;, &lt;br /&gt;
    new THREE.BufferAttribute(plane.geometry.attributes.uv.array,2)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MeshPhysicalMaterial ===&lt;br /&gt;
Wie MeshStandardMaterial bietet aber noch zusätzlich ein Coating. Also z.b. ein Material unter einer Lackschicht. &lt;br /&gt;
 https://threejs.org/examples/#webgl_materials_physical_clearcoat&lt;br /&gt;
* Zusätzlich Coating&lt;br /&gt;
* Nicht so Performant wie Standard&lt;br /&gt;
&lt;br /&gt;
=== PointsMaterial ===&lt;br /&gt;
&lt;br /&gt;
You can use PointsMaterial with particles. &lt;br /&gt;
&lt;br /&gt;
=== ShaderMaterial and RawShaderMaterial ===&lt;br /&gt;
&lt;br /&gt;
ShaderMaterial and RawShaderMaterial can both be used to create your own materials.&lt;br /&gt;
&lt;br /&gt;
=== Environment Map ===&lt;br /&gt;
The environment map is like an image of what&amp;#039;s surrounding the scene. You can use it to add reflection or refraction to your objects. It can also be used as lighting information.&lt;br /&gt;
&lt;br /&gt;
You can use it with many of the materials we saw.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// ENVIRONMENTAL MAP&lt;br /&gt;
const cubeTextureLoader = new THREE.CubeTextureLoader()&lt;br /&gt;
// load cube-images in the right order...&lt;br /&gt;
const environmentMapTexture = cubeTextureLoader.load([&lt;br /&gt;
    &amp;#039;/textures/environmentMaps/4/px.png&amp;#039;,&lt;br /&gt;
    &amp;#039;/textures/environmentMaps/4/nx.png&amp;#039;,&lt;br /&gt;
    &amp;#039;/textures/environmentMaps/4/py.png&amp;#039;,&lt;br /&gt;
    &amp;#039;/textures/environmentMaps/4/ny.png&amp;#039;,&lt;br /&gt;
    &amp;#039;/textures/environmentMaps/4/pz.png&amp;#039;,&lt;br /&gt;
    &amp;#039;/textures/environmentMaps/4/nz.png&amp;#039;,&lt;br /&gt;
])&lt;br /&gt;
const material = new THREE.MeshStandardMaterial()&lt;br /&gt;
material.envMap = environmentMapTexture&lt;br /&gt;
material.metalness = 0.7&lt;br /&gt;
material.roughness = 0.2&lt;br /&gt;
&lt;br /&gt;
gui.add(material, &amp;#039;metalness&amp;#039;).min(0).max(1).step(0.0001)&lt;br /&gt;
gui.add(material, &amp;#039;roughness&amp;#039;).min(0).max(1).step(0.0001)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Cubemap erzeugen ====&lt;br /&gt;
Environment Maps gibt es in unterschiedlichen Formaten. Z.b. hier als HDRI:&lt;br /&gt;
 https://polyhaven.com/&lt;br /&gt;
Es gibt Tools um diese in Cubemaps umzuwandeln:&lt;br /&gt;
 https://matheowis.github.io/HDRI-to-CubeMap/&lt;br /&gt;
&lt;br /&gt;
=== Hinweise ===&lt;br /&gt;
Eigenschaften kann man als Konstruktor Objekt übergeben oder direkt setzen oder über set (manchmal praktischer, wenn als Eigenschaftswert ein Objekt erwartet wird (z.B. bei der Farbe ein Farbobjekt)&lt;/div&gt;</summary>
		<author><name>134.3.241.3</name></author>
	</entry>
</feed>