AskingQuestions / Shadeup

A language for WebGPU that makes writing shaders easier
https://shadeup.dev
150 stars 4 forks source link

Cannot run "Bare-bones material graph evaluation" example #4

Closed oktomus closed 1 year ago

oktomus commented 1 year ago

Hi! First of all, thanks for making Shadeup, it's a really cool and useful website :)

I am not able to run the Bare-bones material graph evaluation example, there is some problems with the compute shader.

image

The problem happens on 5.0 and 5.1.

After recompiling shaders (CTRL + SHIFT + I or with the command recompileshaders changed), I noticed the shader of that example was never in the list, even if I edit it. With r.DumpShaderDebugInfo = 1, I noticed the shader was not even in the cache: image image

Here is the BP I run when playing the game: image

The material used as input of the CS: image

oktomus commented 1 year ago

On the other hand, the CalculatePI example works perfectly

AskingQuestions commented 1 year ago

Thanks for the detailed report!

This is something that I neglected to mention in the docs but please make sure the material has the following:

  1. Material domain of Surface
  2. Blend mode of Opaque
  3. Shading model of DefaultLit
  4. Used With Virtual HeightfieldMesh enabled in the details panel

After that please click apply, if there are any errors please screenshot and share here (they should show up in the output panel)

image image

oktomus commented 1 year ago

Hi,

I still have the same problem image

So I tried to do exactly as you, meaning having a Material variable, and now it works. image image

It's super weird no?

oktomus commented 1 year ago

It crashes when using these nodes, I guess something is missing on the compute shader side to bind these values right ? image

AskingQuestions commented 1 year ago

It's super weird no?

Yeah, that's strange. Maybe there's a compilation error somewhere that got resolved with that swap.

It crashes when using these nodes, I guess something is missing on the compute shader side to bind these values right ?

Yeah, I suspect that something in the global view uniform buffer is missing. There's a spot in the main ComputeShader.cpp file that looks like this:

FViewUniformShaderParameters ViewUniformShaderParameters;

ViewUniformShaderParameters.GameTime = GameTime;
ViewUniformShaderParameters.Random = Random;

I'd take a look at what values that bounding box node uses and try to get those filled in the FViewUniformShaderParameters struct