Rendering Video Texture #348
-
Hey! I'm not exactly sure if thats an issue or just a misunderstanding by my side, so im creating this discussion. Issue descriptionThe video texture renders too bright while shading is set to unlit. Neither the material.postLightingColor attribute nor material.emissive has any effect on this. Steps to reproduce the issue
What's the expected result?What's the actual result?Additional code detailsMaterial : MaterialBuilder materialBuilder = new MaterialBuilder()
.platform(MaterialBuilder.Platform.MOBILE)
.name("External Video Material")
.require(MaterialBuilder.VertexAttribute.UV0)
.shading(MaterialBuilder.Shading.UNLIT)
.doubleSided(true)
.samplerParameter(MaterialBuilder.SamplerType.SAMPLER_EXTERNAL, MaterialBuilder.SamplerFormat.FLOAT, MaterialBuilder.ParameterPrecision.DEFAULT, "videoTexture")
.optimization(MaterialBuilder.Optimization.NONE);
MaterialPackage plainVideoMaterialPackage = materialBuilder
.blending(MaterialBuilder.BlendingMode.OPAQUE)
.material("void material(inout MaterialInputs material) {\n" +
" prepareMaterial(material);\n" +
" material.baseColor = texture(materialParams_videoTexture, getUV0()).rgba;\n" +
" material.postLightingColor = float4(0.0);\n" +
" material.emissive = float4(0.0, 0.0, 0.0, 1.0);\n" +
"}\n")
.build(filamentEngine); Configs config.updateMode = Config.UpdateMode.LATEST_CAMERA_IMAGE
config.focusMode = Config.FocusMode.AUTO
config.planeFindingMode = Config.PlaneFindingMode.DISABLED
config.augmentedImageDatabase = imageDatabase
config.lightEstimationMode = Config.LightEstimationMode.DISABLED
session.configure(config)
arSceneView?.lightEstimationConfig = LightEstimationConfig.DISABLED
arSceneView?.renderer!!.filamentView.colorGrading = ColorGrading.Builder().toneMapping(ColorGrading.ToneMapping.FILMIC)
.build(EngineInstance.getEngine().filamentEngine)
arSceneView?.setSession(session) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi! material.baseColor.rgb = inverseTonemap(material.baseColor.rgb) |
Beta Was this translation helpful? Give feedback.
Hi!
If you think that it is related to tone mapping, you can cancel the effect of tone mapping using the
inverseTonemap
function: https://google.github.io/filament/Materials.html#materialdefinitions/shaderpublicapis/fragmentonlymaterial.baseColor.rgb = inverseTonemap(material.baseColor.rgb)