Enable backface culling by default.
Disable only for geom types that need it (planes and triangles). PiperOrigin-RevId: 914211570 Change-Id: Id95e32924122789111f561d922110128b3f56c77
This commit is contained in:
committed by
Copybara-Service
parent
5339d9154e
commit
3f3ff85a59
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : pbr,
|
name : pbr,
|
||||||
shadingModel : lit,
|
shadingModel : lit,
|
||||||
culling: none,
|
|
||||||
flipUV: false,
|
flipUV: false,
|
||||||
parameters : [
|
parameters : [
|
||||||
{ type : sampler2d, name : BaseColor },
|
{ type : sampler2d, name : BaseColor },
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : pbr_packed,
|
name : pbr_packed,
|
||||||
shadingModel : lit,
|
shadingModel : lit,
|
||||||
culling: none,
|
|
||||||
flipUV: false,
|
flipUV: false,
|
||||||
parameters : [
|
parameters : [
|
||||||
{ type : sampler2d, name : BaseColor },
|
{ type : sampler2d, name : BaseColor },
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : phong_2d,
|
name : phong_2d,
|
||||||
shadingModel : specularGlossiness,
|
shadingModel : specularGlossiness,
|
||||||
culling : none,
|
|
||||||
flipUV : false,
|
flipUV : false,
|
||||||
parameters : [
|
parameters : [
|
||||||
{ type : float4, name : BaseColorFactor },
|
{ type : float4, name : BaseColorFactor },
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : phong_2d_fade,
|
name : phong_2d_fade,
|
||||||
shadingModel : specularGlossiness,
|
shadingModel : specularGlossiness,
|
||||||
culling : none,
|
|
||||||
flipUV : false,
|
flipUV : false,
|
||||||
blending: fade,
|
blending: fade,
|
||||||
parameters : [
|
parameters : [
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : phong_2d_reflect,
|
name : phong_2d_reflect,
|
||||||
shadingModel : specularGlossiness,
|
shadingModel : specularGlossiness,
|
||||||
culling : none,
|
|
||||||
flipUV : false,
|
flipUV : false,
|
||||||
parameters : [
|
parameters : [
|
||||||
{ type : float4, name : BaseColorFactor },
|
{ type : float4, name : BaseColorFactor },
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : phong_2d_uv,
|
name : phong_2d_uv,
|
||||||
shadingModel : specularGlossiness,
|
shadingModel : specularGlossiness,
|
||||||
culling : none,
|
|
||||||
flipUV : false,
|
flipUV : false,
|
||||||
parameters : [
|
parameters : [
|
||||||
{ type : float4, name : BaseColorFactor },
|
{ type : float4, name : BaseColorFactor },
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : phong_2d_uv_fade,
|
name : phong_2d_uv_fade,
|
||||||
shadingModel : specularGlossiness,
|
shadingModel : specularGlossiness,
|
||||||
culling : none,
|
|
||||||
flipUV : false,
|
flipUV : false,
|
||||||
blending: fade,
|
blending: fade,
|
||||||
parameters : [
|
parameters : [
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : phong_2d_uv_reflect,
|
name : phong_2d_uv_reflect,
|
||||||
shadingModel : specularGlossiness,
|
shadingModel : specularGlossiness,
|
||||||
culling : none,
|
|
||||||
flipUV : false,
|
flipUV : false,
|
||||||
parameters : [
|
parameters : [
|
||||||
{ type : float4, name : BaseColorFactor },
|
{ type : float4, name : BaseColorFactor },
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : phong_color,
|
name : phong_color,
|
||||||
shadingModel : specularGlossiness,
|
shadingModel : specularGlossiness,
|
||||||
culling: none,
|
|
||||||
parameters : [
|
parameters : [
|
||||||
{ type : float4, name : BaseColorFactor },
|
{ type : float4, name : BaseColorFactor },
|
||||||
{ type : float, name : SpecularFactor },
|
{ type : float, name : SpecularFactor },
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : phong_color_fade,
|
name : phong_color_fade,
|
||||||
shadingModel : specularGlossiness,
|
shadingModel : specularGlossiness,
|
||||||
culling: none,
|
|
||||||
blending: fade,
|
blending: fade,
|
||||||
parameters : [
|
parameters : [
|
||||||
{ type : float4, name : BaseColorFactor },
|
{ type : float4, name : BaseColorFactor },
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : phong_color_reflect,
|
name : phong_color_reflect,
|
||||||
shadingModel : specularGlossiness,
|
shadingModel : specularGlossiness,
|
||||||
culling: none,
|
|
||||||
parameters : [
|
parameters : [
|
||||||
{ type : float4, name : BaseColorFactor },
|
{ type : float4, name : BaseColorFactor },
|
||||||
{ type : float, name : SpecularFactor },
|
{ type : float, name : SpecularFactor },
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : phong_cube,
|
name : phong_cube,
|
||||||
shadingModel : specularGlossiness,
|
shadingModel : specularGlossiness,
|
||||||
culling : none,
|
|
||||||
flipUV : false,
|
flipUV : false,
|
||||||
parameters : [
|
parameters : [
|
||||||
{ type : float4, name : BaseColorFactor },
|
{ type : float4, name : BaseColorFactor },
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : phong_cube_fade,
|
name : phong_cube_fade,
|
||||||
shadingModel : specularGlossiness,
|
shadingModel : specularGlossiness,
|
||||||
culling : none,
|
|
||||||
flipUV : false,
|
flipUV : false,
|
||||||
blending: fade,
|
blending: fade,
|
||||||
parameters : [
|
parameters : [
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : phong_cube_reflect,
|
name : phong_cube_reflect,
|
||||||
shadingModel : specularGlossiness,
|
shadingModel : specularGlossiness,
|
||||||
culling : none,
|
|
||||||
flipUV : false,
|
flipUV : false,
|
||||||
parameters : [
|
parameters : [
|
||||||
{ type : float4, name : BaseColorFactor },
|
{ type : float4, name : BaseColorFactor },
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : unlit_decor,
|
name : unlit_decor,
|
||||||
shadingModel : unlit,
|
shadingModel : unlit,
|
||||||
culling: none,
|
|
||||||
parameters : [
|
parameters : [
|
||||||
{ type : float4, name : BaseColorFactor }
|
{ type : float4, name : BaseColorFactor }
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ material {
|
|||||||
name : unlit_depth,
|
name : unlit_depth,
|
||||||
shadingModel : unlit,
|
shadingModel : unlit,
|
||||||
blending : opaque,
|
blending : opaque,
|
||||||
culling: none,
|
|
||||||
depthWrite: true
|
depthWrite: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
material {
|
material {
|
||||||
name : unlit_segmentation,
|
name : unlit_segmentation,
|
||||||
shadingModel : unlit,
|
shadingModel : unlit,
|
||||||
culling: none,
|
|
||||||
parameters : [
|
parameters : [
|
||||||
{ type : float4, name : SegmentationColor }
|
{ type : float4, name : SegmentationColor }
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -77,6 +77,11 @@ void Renderable::SetMesh(const Mesh* mesh, int elem_offset, int elem_count) {
|
|||||||
if (mesh == nullptr) {
|
if (mesh == nullptr) {
|
||||||
mju_error("Cannot set mesh to nullptr.");
|
mju_error("Cannot set mesh to nullptr.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We use MESH, even though it could be any mesh-like geom type, e.g.
|
||||||
|
// heightfields, flex, skin, sdf, etc.
|
||||||
|
geom_type_ = mjGEOM_MESH;
|
||||||
|
|
||||||
filament::VertexBuffer* vertex_buffer = mesh->GetFilamentVertexBuffer();
|
filament::VertexBuffer* vertex_buffer = mesh->GetFilamentVertexBuffer();
|
||||||
if (vertex_buffer == nullptr) {
|
if (vertex_buffer == nullptr) {
|
||||||
mju_error("Invalid (null) vertex buffer.");
|
mju_error("Invalid (null) vertex buffer.");
|
||||||
@@ -234,6 +239,10 @@ void Renderable::AssignMaterial(mjrDrawMode mode,
|
|||||||
}
|
}
|
||||||
if (material) {
|
if (material) {
|
||||||
instances_[index] = material->createInstance();
|
instances_[index] = material->createInstance();
|
||||||
|
if (geom_type_ == mjGEOM_PLANE || geom_type_ == mjGEOM_TRIANGLE) {
|
||||||
|
instances_[index]->setCullingMode(
|
||||||
|
filament::MaterialInstance::CullingMode::NONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,6 +416,7 @@ ObjectManager::MaterialType Renderable::GetColorMaterialType() const {
|
|||||||
|
|
||||||
void Renderable::SetGeomMesh(mjtGeom type, int nstack, int nslice, int nquad) {
|
void Renderable::SetGeomMesh(mjtGeom type, int nstack, int nslice, int nquad) {
|
||||||
Builtins* builtins = object_mgr_->GetBuiltins(nstack, nslice, nquad);
|
Builtins* builtins = object_mgr_->GetBuiltins(nstack, nslice, nquad);
|
||||||
|
geom_type_ = type;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case mjGEOM_PLANE:
|
case mjGEOM_PLANE:
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ class Renderable : public mjrRenderable {
|
|||||||
ObjectManager* object_mgr_;
|
ObjectManager* object_mgr_;
|
||||||
mjrRenderableParams params_;
|
mjrRenderableParams params_;
|
||||||
filament::MaterialInstance* instances_[mjNUM_DRAW_MODES] = {nullptr};
|
filament::MaterialInstance* instances_[mjNUM_DRAW_MODES] = {nullptr};
|
||||||
|
mjtGeom geom_type_ = mjGEOM_NONE;
|
||||||
mjrMaterial material_;
|
mjrMaterial material_;
|
||||||
mjrDrawMode draw_mode_ = mjDRAW_MODE_COLOR;
|
mjrDrawMode draw_mode_ = mjDRAW_MODE_COLOR;
|
||||||
filament::Scene* assigned_scene_ = nullptr;
|
filament::Scene* assigned_scene_ = nullptr;
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ SceneView::SceneView(FilamentContext* ctx, const mjrSceneParams& params)
|
|||||||
reflect_view_->setCamera(reflect_camera_);
|
reflect_view_->setCamera(reflect_camera_);
|
||||||
reflect_view_->setShadowingEnabled(false);
|
reflect_view_->setShadowingEnabled(false);
|
||||||
reflect_view_->setPostProcessingEnabled(false);
|
reflect_view_->setPostProcessingEnabled(false);
|
||||||
|
reflect_view_->setFrontFaceWindingInverted(true);
|
||||||
reflect_view_->setVisibleLayers(0xff, params.reflection_layer_mask);
|
reflect_view_->setVisibleLayers(0xff, params.reflection_layer_mask);
|
||||||
|
|
||||||
// Disable post processing for the depth and segmentation views to preserve
|
// Disable post processing for the depth and segmentation views to preserve
|
||||||
|
|||||||
Reference in New Issue
Block a user