Add uv offsets to autogenerated 2D uv coordinates.
The original render_gl3.c code does the following: ``` mjr_setf4(plane, 0.5*scl[0], 0, 0, -0.5); glTexGenfv(GL_S, GL_OBJECT_PLANE, plane); mjr_setf4(plane, 0, -0.5*scl[1], 0, -0.5); glTexGenfv(GL_T, GL_OBJECT_PLANE, plane); ``` The 4th component of the GL_OBJECT_PLANE function effectively describes a UV-offset for the generates uvs. In our filament implementation, we had overlooked this 4th component. PiperOrigin-RevId: 863181644 Change-Id: I60688117ea2019257da683cdda0c7d389dd5af1e
This commit is contained in:
committed by
Copybara-Service
parent
f022faadf7
commit
e35c981f48
@@ -23,6 +23,7 @@ material {
|
||||
{ type : float, name : GlossinessFactor },
|
||||
{ type : float, name : EmissiveFactor },
|
||||
{ type : float3, name : UvScale },
|
||||
{ type : float3, name : UvOffset },
|
||||
{ type : sampler2d, name : BaseColor }
|
||||
],
|
||||
variables : [
|
||||
@@ -38,7 +39,7 @@ vertex {
|
||||
|
||||
fragment {
|
||||
void material(inout MaterialInputs material) {
|
||||
vec2 uv = variable_vertex_pos.xy * materialParams.UvScale.xy;
|
||||
vec2 uv = variable_vertex_pos.xy * materialParams.UvScale.xy + materialParams.UvOffset.xy;
|
||||
|
||||
prepareMaterial(material);
|
||||
material.baseColor = materialParams.BaseColorFactor;
|
||||
|
||||
@@ -24,6 +24,7 @@ material {
|
||||
{ type : float, name : GlossinessFactor },
|
||||
{ type : float, name : EmissiveFactor },
|
||||
{ type : float3, name : UvScale },
|
||||
{ type : float3, name : UvOffset },
|
||||
{ type : sampler2d, name : BaseColor }
|
||||
],
|
||||
variables : [
|
||||
@@ -39,7 +40,7 @@ vertex {
|
||||
|
||||
fragment {
|
||||
void material(inout MaterialInputs material) {
|
||||
vec2 uv = variable_vertex_pos.xy * materialParams.UvScale.xy;
|
||||
vec2 uv = variable_vertex_pos.xy * materialParams.UvScale.xy + materialParams.UvOffset.xy;
|
||||
|
||||
prepareMaterial(material);
|
||||
material.baseColor = materialParams.BaseColorFactor;
|
||||
|
||||
Reference in New Issue
Block a user