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"

Strange behavior of material (blend mode opaque) placed on instanced static mesh

Hi,

I have very strange rendering of material (blend mode opaque and Masked) placed on instanced static mesh. Please look at video -> link text

When I generated instances in instanced static mesh it looks like Antialiasing is activated after I move the camera.

If I set blend mode to Additive or Translucent it works fine.

Where is the problem ?

Thanks

Product Version: Not Selected
Tags:
more ▼

asked Jan 12 '16 at 11:03 PM in Using UE4

avatar image

Vaclav.Jarko
21 1 4 7

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

1 answer: sort voted first

The blurring is caused by the motion blur effect in UE4. Translucent materials do not cause motion blur in the same way, which is why changing your material to be translucent causes the effect to diminish.

You can disable motion blur by placing a postprocess volume in your world, setting it to Unbounded, and setting motion blur to 0.

more ▼

answered Jan 13 '16 at 12:46 AM

avatar image

cancel
2.4k 101 72 124

avatar image Vaclav.Jarko Jan 13 '16 at 06:46 PM

Looks like you don't know what I mean. I don't mean blur effect itself. I am talking about not fully rendered grid until I will start move with camera.

avatar image cancel Jan 14 '16 at 03:08 AM

Ah. Can you post a picture of your material's node graph?

My guess is this is what is happening: You are hiding or unhiding some kind grid which is made out of a bunch of instanced static meshes and a material.

Is that right?

If so, I can tell you what is causing the artifacts. It is from the temporal AA that UE4 uses. Temporal AA gathers data across multiple frames to accomplish smooth subpixel rendering. However, if something is not moving on screen, it is discards the old data more slowly. This has some side effects. One of them is that if something completely vanishes or reappears instantly, the temporal AA will not respond to it correctly, because it does not think it is moving. Once you move the camera, the temporal AA discards older pixels, which will then converge on a clean result.

There are a few ways you can work around this. One way is to have your grid animate a little bit when you unhide it. For example, have it move on the Z axis a centimeters in a short animation after unhiding it. Another way would be to have 2 materials for your grid: one of them is translucent and has 'responsive AA' enabled, and then after a short period of time after unhiding the grid, you swap that material out for a regular opaque one.

Another way, if you are brave and a bit knowledgeable, would be to dig into the .usf shaders for vertex velocity buffers and temporal AA, and add your own code to flush the stale pixels out when you hide/unhide your grid.

There are probably other ways to accomplish this that I'm unaware of as well.

avatar image Vaclav.Jarko Jan 14 '16 at 07:54 AM

Hi thanks for answer. Here is my material nodes (very simple) and settings.

alt text

alt text

avatar image Vaclav.Jarko Jan 14 '16 at 08:00 AM

Basically what I am doing is :

 FActorSpawnParameters xSpawnInfo;
 xSpawnInfo.SpawnCollisionHandlingOverride =  ESpawnActorCollisionHandlingMethod::Undefined;
 xSpawnInfo.Owner = pxFloor;
 xSpawnInfo.Name = "FullGrid";
 xSpawnInfo.Instigator = nullptr;
 xSpawnInfo.bDeferConstruction = false;
 
 // Position
 FVector xLocation;
 xLocation.X = ASC_Grid::s_fASSUMED_CELL_SIZE * 0.5f;
 xLocation.Y = ASC_Grid::s_fASSUMED_CELL_SIZE * 0.5f;
 xLocation.Z = 0.1f;
 
 if (m_pxFullGrid == nullptr)
 {
     m_pxFullGrid = pxWorld->SpawnActor<ASC_Grid>(ASC_Grid::StaticClass(),    xLocation,       FRotator::ZeroRotator, xSpawnInfo);
 }
 
 if (m_pxFullGrid && m_pxFullGrid->InstancedStaticMeshComponent)
 {
     FTransform xCellTransform = m_pxFullGrid->GetTransform();
     const int32 iXNumCells = FMath::CeilToInt(pxFloor->GetComponentsBoundingBox().GetSize().X * 0.01f);
     const int32 iYNumCells = FMath::CeilToInt(pxFloor->GetComponentsBoundingBox().GetSize().Y * 0.01f);
 
     for (int32 i = 0; i < iYNumCells; ++i)
     {
         for (int32 j = 0; j < iXNumCells; ++j)
         {
             xCellTransform.SetLocation(FVector(ASC_Grid::s_fASSUMED_CELL_SIZE * j, ASC_Grid::s_fASSUMED_CELL_SIZE * i, 0.0f));
             m_pxFullGrid->InstancedStaticMeshComponent->AddInstance(xCellTransform);
         }
     }
 
     FString szPathName = "/Game/StarCrooks/Materials/Grid/GridCell";
     UMaterial* pxCellMaterial = Cast<UMaterial>(StaticLoadObject(UMaterial::StaticClass(), NULL, *szPathName));
     if (pxCellMaterial)
     {
         pxCellMaterial->bUsedWithInstancedStaticMeshes = true;
         m_pxFullGrid->InstancedStaticMeshComponent->SetMaterial(0, pxCellMaterial);
     }
 
     return true;
 }
avatar image cancel Jan 14 '16 at 08:11 AM

Ok. My guess is that it's caused by temporal AA. You might want to try one of my suggestions from above, such as a brief animation after spawning the grid, or swapping out materials after a few frames of it being visible.

avatar image Vaclav.Jarko Jan 14 '16 at 08:49 AM

Thanks. I will try to swap the materials but I am a little bit scared that I will see some strange flesh during swap material in real time.

(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