OGLSurfaceNormalMapShader.kl¶
Types¶
OGLSurfaceNormalMapShader (object)¶
バージョン 1.12.0 で追加.
The OGLSurfaceNormalMapShader inherits the OGLInlineShader. It extends the OGLInlineShader for shading with a simple phong model using a texture for the diffuse and performing normal mapping.
Uniforms¶
Name | Type | Description | Default |
---|---|---|---|
u_light0Position | Vec3 | Position of the first light | Position of the camera |
u_light0Color | Color | Color of the first light | Color(1.0, 1.0, 1.0) |
u_ambientColor | Color | Ambient color component | Color(0.05, 0.05, 0.05) |
u_diffuseColor | Color | Diffuse color component | Color(1.0, 1.0, 1.0) |
u_specularColor | Color | Specular color component | Color(0.2, 0.2, 0.2) |
u_specularFactor | Color | Specular distribution factor | 16.0 |
u_diffuseTexture | Texture | Texture used for the diffuse | null |
u_normalsTexture | Texture | Texture used for the normals | null |
u_mirrorU | Integer | Flag toggle a flip of the U component | 0 |
u_mirrorV | Integer | Flag toggle a flip of the V component | 1 |
u_bumpStrength | Scalar | Determines the strength of the bump | 1.0 |
Attributes¶
Name | Type | Description |
---|---|---|
positions | Vec3 | Geometry positions |
normals | Vec3 | Geometry normals |
tangents | Vec3 | Geometry tangents |
uvs0 | Vec2 | UV set |
/*
** Example: OGLSurfaceNormalMapShader
*/
require InlineDrawing;
operator entry() {
InlineDrawing draw = OGLInlineDrawing();
InlineShader shader = draw.registerShader(OGLSurfaceNormalMapShader);
InlineMaterial mat = shader.getOrCreateMaterial('normalMap');
InlineTexture diffuseTexture = draw.registerTexture(InlineFileBasedTexture('diffuse.png'));
InlineTexture normalsTexture = draw.registerTexture(InlineFileBasedTexture('normal.png'));
mat.setUniform('u_diffuseTexture', diffuseTexture);
mat.setUniform('u_normalsTexture', normalsTexture);
}
/*
** Output:
*/
Methods¶
OGLSurfaceNormalMapShader ( in OGLSurfaceNormalMapShader other ) | |
OGLSurfaceNormalMapShader ( in String name ) | |
OGLSurfaceNormalMapShader () | |
OGLSurfaceNormalMapShader | clone ? () |
init ! ( in String name ) |