question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Models created via a script behave unexpectedly with materials that have a normal map

See original GitHub issue

Release Type: Official Release

Version: 3.0.0.8 & 3.1

Platform(s): Windows

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Open Xenko Launcher.
  2. Create a new Project - New game. Include the Materials Pack asset pack.
  3. Create a new empty entity.
  4. Create a new script with the following code:
    using Xenko.Engine;
    using Xenko.Extensions;
    using Xenko.Graphics.GeometricPrimitives;
    using Xenko.Rendering;

    public class MeshScript : SyncScript
    {
        public Material Material
        {
            get;
            set;
        }
            
        // Declared public member fields and properties will show in the game studio

        public override void Start()
        {   
            var meshDraw = GeometricPrimitive.Sphere.New(this.GraphicsDevice).ToMeshDraw();
            var mesh = new Mesh() { Draw = meshDraw };
            
            var model = new Model();
            model.Meshes.Add(mesh);
            model.Materials.Add(this.Material);
            
            var modelComponent = this.Entity.GetOrCreate<ModelComponent>();
            modelComponent.Model = model;
        }

        public override void Update()
        {
            // Do stuff every new frame
        }
    }
  1. Add the script to the empty entity.
  2. Assign a PBR texture from the pack (such as Materials/brick/brick). Seems to only affect materials with a normal map.
  3. Build and run the game.

Expected behavior A sphere to appear in game rendered with the specified material.

Screenshots Testttt Windows_IP4HwH2Vem

Disabling Bright Filter post-processing:

TestProceduralMesh Windows_9De9X1D0g5

Disabling Surface normal map on brick texture:

TestProceduralMesh Windows_QQoIxecLQ1

Log and callstacks n/a

Additional context Disabling all post-processing removes the black artifacts but the model renders in all black.

ReproProject.zip

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
lariniuscommented, Feb 22, 2022

Found solution in Blender when exporting FBX files! It’s under the Geometries tab, at the bottom – make sure “Tangent Space” is checked on: image

1reaction
jeskecommented, Apr 29, 2020

At the very least, the documentation should be updated to correctly explain how to create a sphere that contains tangent data… since right now it advocates using:

var meshDraw = Stride.Graphics.GeometricPrimitives.GeometricPrimitive.Sphere.New(GraphicsDevice).ToMeshDraw();

https://doc.xenko.com/latest/en/manual/scripts/create-a-model-from-code.html

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Models created via a script behave unexpectedly with ...
To Reproduce Steps to reproduce the behavior: Open Xenko Launcher. ... script behave unexpectedly with materials that have a normal map #413.
Read more >
Help! Normal Map Suddenly appearing weird
Problem: My normal map renders out fine in 3ds Max , however I noticed that when I rotated the 3d model which had...
Read more >
Unexpected results with normal map - Talk
I have a wall texture I'd like to use as a normal map but it isn't behaving as I'd expect. Specifically, shadows and...
Read more >
PBR Textures | Documentation - Roblox Creator Hub
This guide provides instructions on setting up your mesh objects to use PBR textures maps and describes common use-cases and best practices for...
Read more >
Accidentally Painting Normal Map
I recently baked a normal map from a high poly to a low poly, and then set up the normal map in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found