Skip to content

Commit

Permalink
Merge pull request #213 from e2002e/gi_clipmaps
Browse files Browse the repository at this point in the history
Gi clipmaps fix latency and crashes
  • Loading branch information
luboslenco authored Aug 8, 2024
2 parents e2f4750 + 3debc86 commit 268a59e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
12 changes: 8 additions & 4 deletions Sources/iron/RenderPath.hx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class RenderPath {
return 64;
#elseif (rp_voxelgi_resolution == 32)
return 32;
#elseif (rp_voxelgi_resolution == 16)
return 16;
#else
return 0;
#end
Expand Down Expand Up @@ -689,15 +691,17 @@ class RenderPath {
// Image only
var img = Image.create3D(width, height, depth,
t.format != null ? getTextureFormat(t.format) : TextureFormat.RGBA32);
if (t.mipmaps) img.generateMipmaps(1000); // Allocate mipmaps
return img;
if (t.mipmaps)
img.generateMipmaps(1000); // Allocate mipmaps
return img;
}
else { // 2D texture
if (t.is_image != null && t.is_image) { // Image
var img = Image.create(width, height,
t.format != null ? getTextureFormat(t.format) : TextureFormat.RGBA32);
if (t.mipmaps) img.generateMipmaps(1000); // Allocate mipmaps
return img;
if (t.mipmaps)
img.generateMipmaps(1000); // Allocate mipmaps
return img;
}
else { // Render target
return Image.createRenderTarget(width, height,
Expand Down
2 changes: 1 addition & 1 deletion Sources/iron/object/LightObject.hx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class LightObject extends Object {
public var lightInAtlas = false;
public var culledLight = false;
public static var pointLightsData: kha.arrays.Float32Array = null;
public var shadowMapScale = 0.0;
public var shadowMapScale = 1.0; // When in forward if this defaults to 0.0, the atlas are not drawn before being bound.
// Data used in uniforms
public var tileOffsetX: Array<Float> = [0.0];
public var tileOffsetY: Array<Float> = [0.0];
Expand Down
4 changes: 2 additions & 2 deletions Sources/iron/object/Uniforms.hx
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ class Uniforms {
// Multiple voxel volumes, always set params
g.setImageTexture(context.textureUnits[j], rt.image); // image2D/3D
if (rt.raw.name.startsWith("voxels_")) {
g.setTextureParameters(context.textureUnits[j], TextureAddressing.Clamp, TextureAddressing.Clamp, TextureFilter.LinearFilter, TextureFilter.LinearFilter, MipMapFilter.LinearMipFilter);
g.setTextureParameters(context.textureUnits[j], TextureAddressing.Clamp, TextureAddressing.Clamp, TextureFilter.LinearFilter, TextureFilter.LinearFilter, MipMapFilter.NoMipFilter);
}
else if (rt.raw.name.startsWith("voxels"))
{
g.setTexture3DParameters(context.textureUnits[j], TextureAddressing.Clamp, TextureAddressing.Clamp, TextureAddressing.Clamp, TextureFilter.LinearFilter, TextureFilter.LinearFilter, MipMapFilter.LinearMipFilter);
g.setTexture3DParameters(context.textureUnits[j], TextureAddressing.Clamp, TextureAddressing.Clamp, TextureAddressing.Clamp, TextureFilter.LinearFilter, TextureFilter.LinearFilter, MipMapFilter.NoMipFilter);
}
else
{
Expand Down

0 comments on commit 268a59e

Please sign in to comment.