It comes from BitmapCombine !!!
In order to create my randomly generated galaxy background, I create a Bitmap with:
Code: Select all
BitmapNoise (R)
BitmapNoise (G)
BitmapCombine
BitmapNoise (B)
BitmapCombine
BitmapExpression
I made a quick mock-up in order to try (if you have a Huawei, Xiamoi or Xperia phone). Just press the screen to switch the background material and show the bug.
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="test" ScreenMode="0" FileVersion="2" AndroidPackageName="com.txori.test" AndroidPortrait="2">
<OnLoaded>
<SpawnModel Model="BackgroundModel"/>
<SpawnModel Model="DebugModel"/>
</OnLoaded>
<OnUpdate>
<ZExpression>
<Expression>
<![CDATA[TouchCount=0;
if (touchGetCount()>0) TouchCount=1;]]>
</Expression>
</ZExpression>
<KeyPress Comment="Mouse click" Keys="{">
<OnPressed>
<ZExpression Expression="TouchCount = 1;"/>
</OnPressed>
</KeyPress>
</OnUpdate>
<Content>
<Mesh Name="DebugMesh">
<Producers>
<MeshBox/>
<MeshSphere/>
<MeshCombine/>
</Producers>
</Mesh>
<Model Name="DebugModel" RotationVelocity="0.1 0.1 0.1">
<OnRender>
<UseMaterial Material="FlatMaterial"/>
<RenderMesh Mesh="DebugMesh"/>
</OnRender>
</Model>
<Material Name="FlatMaterial" Shading="1"/>
<Group Comment="Background">
<Children>
<Model Name="BackgroundModel" Position="0 0 4">
<OnRender>
<Condition Expression="return TouchCount;">
<OnTrue>
<UseMaterial Material="MultiMaterial"/>
</OnTrue>
<OnFalse>
<UseMaterial Material="SingleMaterial"/>
</OnFalse>
</Condition>
<RenderMesh Mesh="BackgroundMesh"/>
</OnRender>
</Model>
<Mesh Name="BackgroundMesh">
<Producers>
<MeshBox Scale="8 4.5 1" Grid2DOnly="255"/>
</Producers>
</Mesh>
<Material Name="SingleMaterial" Shading="1" Light="0" ZBuffer="0">
<Textures>
<MaterialTexture Texture="SingleBitmap" TextureWrapMode="1" TexCoords="1"/>
</Textures>
</Material>
<Material Name="MultiMaterial" Shading="1" Light="0" ZBuffer="0">
<Textures>
<MaterialTexture Texture="MultiBitmap" TextureWrapMode="1" TexCoords="1"/>
</Textures>
</Material>
<Bitmap Name="SingleBitmap">
<Producers>
<BitmapNoise Color="1"/>
<BitmapExpression>
<Expression>
<![CDATA[//X,Y : current coordinate (0..1)
//Pixel : current color (rgb)
//Sample expression: Pixel.R=abs(sin(X*16));
//Pixel.R *= .6;
//Pixel.G *= .6;
//Pixel.B *= .6;
Pixel.A = 1;]]>
</Expression>
</BitmapExpression>
</Producers>
</Bitmap>
<Bitmap Name="MultiBitmap">
<Producers>
<BitmapNoise Comment="R" Offset="0.143" Persistence="0" ZHeight="0" Color="1" Tile="255"/>
<BitmapNoise Comment="B" Offset="0.0637" Persistence="0" ZHeight="0" Color="3" Tile="255"/>
<BitmapCombine/>
<BitmapNoise Comment="G" Offset="0.0547" Persistence="0" ZHeight="0" Color="2" Tile="255"/>
<BitmapCombine/>
<BitmapExpression>
<Expression>
<![CDATA[//X,Y : current coordinate (0..1)
//Pixel : current color (rgb)
//Sample expression: Pixel.R=abs(sin(X*16));
/*Pixel.R *= .8;
Pixel.G *= .8;
Pixel.B *= .8;*/
Pixel.A = 1;]]>
</Expression>
</BitmapExpression>
</Producers>
</Bitmap>
</Children>
</Group>
<Variable Name="TouchCount" Type="4"/>
</Content>
</ZApplication>
Edit:
For starters, I'm going to use this in order to release a working APK on Google Play:
Code: Select all
BitmapNoise (white)
BitmapExpression
Pixel.R *= sin(X);
Pixel.G *= sin(Y);
Pixel.B *= cos(X);
Pixel.A = 1;