heyx3 / GPUNoiseForUnity

A Unity plugin for generating noise on the GPU for use in the editor.
Other
109 stars 17 forks source link

[BUG] Nodes generating commas instead of dots #8

Open jiDOK opened 5 years ago

jiDOK commented 5 years ago

Hi, I really like this project!

There's a bug in newer Unity versions. Tested with Unity 2019.1.9f1 and 2019.2.0f1 on a German Windows 10 PC.

Description: When GPUGraph Editor Nodes are parsed, commas are generated instead of dots. This causes the shader compilation to fail. This is on a German Win10 machine.

Error message: Shader error in 'MyGPUGShader0': Parse error: syntax error, unexpected ',', expecting TVAL_ID or TVAL_VARREF at line 9

Generated line: TurbulencePower ("TurbulencePower", Range(0, 5)) = 1,875.0

Unity has had the comma-dot-culture bug for a while, but I thought they said they've fixed it by now. So I don't know what's going on there. It works fine in Unity 5.6.3f1 but I'd really like to use the plugin in newer versions...

Thanks!

Bamboy commented 5 years ago

This asset completely broke when I upgraded an old project to Unity 2018.3. It wouldn't even open the editor window. I ended up just getting rid of it; It didn't work for my project anyway because I needed determinism. Still it's a super neat asset. Not sure if the new Unity shader graph could be a reliable replacement?

jiDOK commented 5 years ago

Well sooner or later probably. But I think Shadergraph only has 2D Noise and also only 3 variations. And I think it's not possible to generate textures and save them as an asset atm. The new render pipelines also seem still a bit buggy to me. So it would be nice to have GPUGraph working in 2019, even if it's only in the old 3D Pipeline.

Bamboy commented 5 years ago

You can save any texture to file. IIRC, use a render texture and you can save the texture including the shader as a png. A simple editor script can do this.

jiDOK commented 5 years ago

Oh yeah, sure, you're right of course. But still no 3D noise/textures, etc. For me this plugin just feels better than the current Shadergraph.

heyx3 commented 5 years ago

Hi, thanks for the feedback! I haven't touched this project in a while, but I can definitely take a look at commas vs dots problem. You're saying that the shader should always output dots and never commas when converting floats to string, regardless of local encoding, to keep the compiler happy?

@Bamboy I'm currently looking at the GPUG editor window in a big 2018.4.5f1 project, and it works for me. Do you have any more details about your problem?

Also, about determinism: what problems are you having with it? Off the top of my head there might be problems if you're comparing a single noise graph across multiple GPU's with different float precision levels, but otherwise it should do the same thing every time.

Integrating/extending the plug-in to work with Unity's own shader graph is certainly a cool idea, but a) the main use-case for this plugin is pretty self-contained I think, and b) I don't want to maintain two versions of the plug-in for old Unity and new Unity :P

jiDOK commented 5 years ago

@heyx3 Yes, I am pretty sure that that is correct. For display it doesn't really matter (except to avoid confusion) but for shader generation it should definitely be dots.

jiDOK commented 5 years ago

Looking at the generated line I posted it seems it has both a comma and a dot, which seems even stranger atm... anyway I will be happy to test and give feedback.