stride3d / stride3d/stride

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

Open
#413 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-Graphics bug
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied ReproProject.zip and the MeshScript example, reproducing the generated sphere with the Materials Pack brick material and its normal map. Compare behavior with Bright Filter, other post-processing disabled, and the surface normal map removed; done means the procedural model renders correctly with the normal-mapped material.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
computer-graphics, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.