Page 1 of 1

BitmapNoise don't look the same in preview and release mode

Posted: Wed May 19, 2021 1:22 pm
by Ats
Hi. Yesterday I spent quite some time tweaking BitmapNoises in preview mode to get what I want. But today, the result is a blurry mess. Turns out that preview and release doesn't show the same thing...

Here's the simple test:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
  <OnRender>
    <UseMaterial Material="MyMaterial"/>
    <RenderMesh Mesh="MyMesh"/>
  </OnRender>
  <Content>
    <Bitmap Name="MyBitmap" Width="256" Height="128">
      <Producers>
        <BitmapNoise Name="Noise" Octaves="2" Offset="0.1" Persistence="20" ZHeight="185.1705" Color="1" Tile="255"/>
      </Producers>
    </Bitmap>
    <Material Name="MyMaterial">
      <Textures>
        <MaterialTexture Texture="MyBitmap" TexCoords="1"/>
      </Textures>
    </Material>
    <Mesh Name="MyMesh">
      <Producers>
        <MeshBox Scale="4 2 1" Grid2DOnly="255"/>
      </Producers>
    </Mesh>
  </Content>
</ZApplication>
This is the preview:
noise_preview.png
noise_preview.png (37.78 KiB) Viewed 7076 times
And this is the result:
noise_release.png
noise_release.png (45.79 KiB) Viewed 7076 times

It looks like the Persistence of the BitmapData is limited to [0,1] in release.
The same goes for Offset.

Re: BitmapNoise don't look the same in preview and release mode

Posted: Wed May 19, 2021 1:41 pm
by VilleK
Actually both Offset and Persistence are supposed to be in the 0 to 1 range. When you use the slider then they have that limit. But it seems there is no check for typing in larger values.

When you save to executable then the values are forced into that range.

Re: BitmapNoise don't look the same in preview and release mode

Posted: Wed May 19, 2021 1:53 pm
by Ats
Oh, all right. So how could I obtain the same result when it is clamped to 0,1 ?
Maybe with some kind of advance technique using a BitmapExpression. But isn't that longer to calculate?

Something like Pixel.R = round(Pixel.R); but a bit more subtle, or followed by a BitmapBlur...


Edit:
Pixel.R = 1/(1+pow(20,60*(0.5-Pixel.R))); :D