Usage of noise() GLSL functions

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Usage of noise() GLSL functions

Re: Usage of noise() GLSL functions

by dpJudas » Thu May 09, 2019 5:22 pm

Maybe that's why the deprecated them. If one of the main stream cards always returned 0.0 then we aren't even breaking any mods by doing this (they were already broken for some subset of the players).

Re: Usage of noise() GLSL functions

by InsanityBringer » Thu May 09, 2019 4:18 pm

just as a side note, did any GPU manufacturers ever actually implement noise? I remember using it a few years back for a thing that generated planets before vulkan was a thing and I always got 0.0 out of every card I was using at the time, so I ended up just writing my own slowass perlin noise system... heh

Re: Usage of noise() GLSL functions

by vsonnier » Thu May 09, 2019 7:23 am

_mental_ wrote:Added in 7e998c2.
Works for me thanks, tried on both GeForce 1050 Ti Mobile (API Vulkan 1.1) and Intel HD Graphics 630 integrated GPU. (API Vulkan 1.0)

Re: Usage of noise() GLSL functions

by _mental_ » Thu May 09, 2019 5:01 am

For old mods this can be solved by patching shaders on runtime before compiling them. Although, this is unrelated issue, or rather feature suggestion.

Re: Usage of noise() GLSL functions

by Talon1024 » Thu May 09, 2019 4:38 am

On a related note, I had to remove/change a bunch of texture2D usages in WolfenDoom: Blade of Agony in order to get it to work with the Vulkan renderer.

Re: Usage of noise() GLSL functions

by _mental_ » Thu May 09, 2019 4:31 am

Added in 7e998c2.

Re: Usage of noise() GLSL functions

by dpJudas » Thu May 09, 2019 4:06 am

Ah, excellent. We can say we are just following the Vulkan standard if people complain. ;)

Adding the functions to the header should be fine - the compiler should optimize them away when they aren't called.

Re: Usage of noise() GLSL functions

by _mental_ » Thu May 09, 2019 3:50 am

GLSL deprecated these functions and conforming implementation should return zero(es).
The noise functions noise1, noise2, noise3, and noise4 have been deprecated starting with version 4.4 of GLSL. When not generating SPIR-V they are defined to return the value 0.0 or a vector whose components are all 0.0. When generating SPIR-V the noise functions are not declared and may not be used.
I think we can start with this dummy implementation because it complies with the spec ;) Is it OK to add these functions to shaders' header?

Re: Usage of noise() GLSL functions

by dpJudas » Thu May 09, 2019 3:37 am

Dummy functions are better than nothing as they will at least let people play a mod that used them.

I fear a full implementation would require binding some random texture or something along those lines. While always binding such a texture isn't too hard, make it part of descriptor set 0 (the "dynamic set"), I'm not sure how that will affect performance. Pretty annoying they used vulkan to get rid of things in glsl they didn't want to implement.

Re: Usage of noise() GLSL functions

by _mental_ » Thu May 09, 2019 2:27 am

I was thinking about fixing this with such dummy functions. However, I'm afraid that some purists will appear quickly to whine aloud and to blame me for screwing "everything".

Re: Usage of noise() GLSL functions

by vsonnier » Thu May 09, 2019 2:16 am

_mental_ wrote:'Do nothing' noise functions should return zeroes instead of their arguments.
The return value(s) are always in the range [-1.0,1.0] ...
The return value(s) have an overall average of 0.0
Thanks! Returning a zero vector do not change the in-game appearence for the Teleport effect, which goal is (as far as I understand the TP.shader code) to
add some sinusoidal wobble to the texture, AND some noise on top of that.
At the end, the noise part looks invisible to the eye all the more that the whole frames are mostly transparent and take no more than few second or something to play during a teleport.

Re: Usage of noise() GLSL functions

by _mental_ » Wed May 08, 2019 1:58 pm

'Do nothing' noise functions should return zeroes instead of their arguments.
The return value(s) are always in the range [-1.0,1.0] ...
The return value(s) have an overall average of 0.0

Re: Usage of noise() GLSL functions

by vsonnier » Wed May 08, 2019 9:21 am

Hello there,

Finally in the particular case of Brutal Doom Black Edition v3.1d Final, I simply replaced the noise2 function everywhere by this:

Code: Select all

vec2 noise2(in vec2 coordinate) {
    // do nothing.
    return coordinate;
}

even for the T(ele)P(ort).shader, where the "doing nothing" noise2 actually gave the closest results to the OpenGL version, while the more compicated one broke the teleport effect.
The simpler the better I suppose.

Re: Usage of noise() GLSL functions

by _mental_ » Thu May 02, 2019 1:20 pm

Regarding noise functions for Vulkan, it’s mostly about how to choose proper implementation. Or to write our own, if no suitable one will be found.

As for macOS imperfect and now deprecated OpenGL, it’s OK to leave it as is. Vulkan renderer, however, is far from being stable here.
There are several known issues which I’m trying to solve, with zero progress so far. Most likely I’ll post a few bug reports soon.

Re: Usage of noise() GLSL functions

by dpJudas » Thu May 02, 2019 11:13 am

I guess since they've been removed in the vulkan glsl compiler it should be safe to just add an implementation of our own. For OpenGL I don't know if we should do something or not. In macOS it would be preferable to get the vulkan backend improved past OpenGL as Apple intends to remove OpenGL anyway.

Does anyone know why they were deprecated/removed? Kind of curious to know the reason.

Top