microsoft / DirectXTK

The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++

Home Page:https://walbourn.github.io/directxtk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Instancing Basic Effect/Normal Map

alekasm opened this issue · comments

commented

I've finally got instancing working (I have some small suggestions for the wiki later). I am running into an issue though with colors. Per your instructions I am loading models that would otherwise be a BasicEffect - as a NormalMapEffect. This works for many of the models, however some specific models have weird color/graphical issues. Below is a comparison with the top being with instancing, and the bottom showing how they are supposed to look.

I'm unsure if this is somehow related to the default normal map being applied to the model? Any pointers or areas to look at?

image

commented

To better illustrate one of these effects:
https://i.gyazo.com/0c5aa2df598771332a2a91bffd8f3609.mp4

I tried lots of different material settings such as high/low specular, roughness, etc. Ive also updated my meshconvert tool.

The normal map requires texture coordinates and normal. Can you check those on your model?

commented

I should have specified that only some of the models which I created have these two classes of problems (black, and then pixel noise effect). Most of the models remain unaffected. My modeler who uses sketchup did not have this issue with his models (we were both using the originally exported cmo files). This is how I export objs in Blender:

image

I'm not sure whether or not these Blender export settings contains the required information; again only a subset of models is this an issue for, so I am fairly confident it cannot be an issue with missing information before it hits meshconvert.

How my modeler fixed some of my models:

It's not inherent to the materials, it seems. If I export directly from the .blend files, the issue persists. It has to be an issue with the geometry -and there could be a couple of things going on. What I ended up doing is just exporting to .dae, importing into Sketchup, reworking affected faces, and re-exporting.

Also interesting is that the models which I created that have been affected will show through my fog effect:
image

Many of the objects will only have parts with "bad geometry" affected, not the entire model. Below is an example of one of the models I created where the pool was affected - additionally I had separated the scene into multiple groups in Blender.
image

After giving the affected model to my artist, this was his rework which fixes the issue (uses a single group):
image

It's not a show stopper because I'm having my modeler help fix all my models, but this only appears to be an issue with GPU instancing. I was just curious in what was causing this problem so I could safely make models again for my project using Blender.

In positive news, GPU instancing is super amazing! Some of my scenes go from 9 FPS -> 500 FPS. Huge uplift and I couldn't be happier with the result, thank you so much for this.

The NormalMapEffect calculates a tangent space basis from the normal and texture coordinates, so it's more sensitive to issues than BasicEffect would have been for untextured content.