add base color/texture to unlit
This commit is contained in:
@@ -1,34 +1,38 @@
|
|||||||
material {
|
material {
|
||||||
name : unlit,
|
name : unlit,
|
||||||
|
requires : [ uv0 ],
|
||||||
parameters : [
|
parameters : [
|
||||||
{
|
{
|
||||||
type : float3,
|
type : sampler2d,
|
||||||
name : color
|
name : baseColorMap
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type : float,
|
type : float4,
|
||||||
name : scale
|
name : baseColorFactor
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type : int,
|
||||||
|
name : baseColorIndex
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
depthWrite : true,
|
depthWrite : true,
|
||||||
depthCulling : false,
|
depthCulling : true,
|
||||||
shadingModel : unlit,
|
shadingModel : unlit,
|
||||||
blending: opaque,
|
blending: opaque,
|
||||||
culling: none,
|
culling: none,
|
||||||
instanced: false,
|
instanced: false,
|
||||||
vertexDomain: object
|
vertexDomain: object
|
||||||
}
|
}
|
||||||
vertex {
|
|
||||||
void materialVertex(inout MaterialVertexInputs material) {
|
|
||||||
float4 position = getPosition();
|
|
||||||
position.xyz *= materialParams.scale;
|
|
||||||
material.worldPosition = getWorldFromModelMatrix() * position;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fragment {
|
fragment {
|
||||||
void material(inout MaterialInputs material) {
|
void material(inout MaterialInputs material) {
|
||||||
prepareMaterial(material);
|
prepareMaterial(material);
|
||||||
material.baseColor = float4(materialParams.color, 1.0);
|
material.baseColor = materialParams.baseColorFactor;
|
||||||
|
|
||||||
|
if (materialParams.baseColorIndex > -1) {
|
||||||
|
highp float2 uv = getUV0();
|
||||||
|
uv.y = 1.0 - uv.y;
|
||||||
|
material.baseColor *= texture(materialParams_baseColorMap, uv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user