x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Lighting on Instanced Static Mesh is very off.

I'm creating a randomly generated maze game. So far I have it working when I spawn each individual mesh as a static mesh actor in c++. To improve performance I'm trying to use instanced static meshes since there will probably be thousands of the same mesh in the scene. But when I did that, the meshes looked very wrong. From one angle it looks fine (although it seems to be a bit darker than it was), but from the opposite angle everything is very dark with terrible artifacting. I have static lighting disabled in the project because the entire level is procedurally spawned in. The game also uses bloom, ambient occlusion, and auto exposure effects. I have no clue why this is happening. Do any of you know?

There is a lot of code I wrote that spawns everything, but this is the code I have for the Instanced Static Mesh Actor:

 const FVector AMazeStaticPiecesActor::zAxis = FVector(0.0f, 0.0f, 1.0f);

 AMazeStaticPiecesActor::AMazeStaticPiecesActor(const FObjectInitializer& oi)
 {
     PrimaryActorTick.bCanEverTick = false;

     instStaticMesh = CreateDefaultSubobject<UInstancedStaticMeshComponent>(TEXT("m"));

     instStaticMesh->BodyInstance.SetObjectType(ECC_WorldStatic);

     instStaticMesh->BodyInstance.SetCollisionEnabled(ECollisionEnabled::NoCollision);
     instStaticMesh->BodyInstance.SetResponseToAllChannels(ECR_Ignore);
 
     RootComponent = instStaticMesh;
 }

    void AMazeStaticPiecesActor::setMesh(const TCHAR* mName)
 {
     instStaticMesh->SetStaticMesh(Cast<UStaticMesh>(StaticLoadObject(UStaticMesh::StaticClass(), nullptr, *(FString(TEXT("/Game/Meshes/")) + mName))));
 }

 void AMazeStaticPiecesActor::spawnPiece(int x, int y, int z, short rot)
 {
     transform.SetIdentity();
     transform.SetRotation(FQuat(zAxis, FMath::DegreesToRadians(rot)));
     transform.SetLocation(FVector(x, y, z));

     instStaticMesh->AddInstanceWorldSpace(transform);
 }

 void AMazeStaticPiecesActor::removePiece(int index)
 {
     instStaticMesh->RemoveInstance(index);
 }

The first image is the angle which looked fine but seems darker than it was. The second image is the angle that looked very wrong. The third image has 3 static meshes spawned in with the editor, and is what the meshes are supposed to look like. alt text

alt text

alt text

Product Version: UE 4.8
Tags:
capture1.png (593.4 kB)
capture2.png (663.0 kB)
capture4.png (502.0 kB)
more ▼

asked Aug 29 '15 at 03:13 AM in Rendering

avatar image

Bill Mess
3 5 5 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Okay, never mind. I finally figured out the problem after several hours of messing around with the editor. I found out that in the static mesh editor, if I uncheck the box that says "Use MikkTSpace Tangent Space", then everything looks how it's supposed to. I have no idea what it means, but I'm so relieved to have the problem finally solved. Perhaps this is a bug that I need to report.

more ▼

answered Aug 30 '15 at 09:56 PM

avatar image

Bill Mess
3 5 5 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question