Jump to content

Can't change the TextureFormat for a RenderTargetTexture


rockefeller
 Share

Recommended Posts

Hey guys,

I want to create a custom RenderTargetTexture of type BABYLON.Engine.TEXTUREFORMAT_LUMINANCE but it doesn't work. here's my code:

textureFormat is always 5 (probably TEXTUREFORMAT_RGBA), regardless of what I set it to be.

 

// Render target
var renderTarget = new BABYLON.RenderTargetTexture( "depth",
128, // res
scene,
false, // generateMipMaps
true, // doNotChangeAspectRatio
BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT, // type
false, // isCube
BABYLON.Texture.BILINEAR_SAMPLINGMODE, // samplingMode
false, // generateDepthBuffer
false, // generateStencilBuffer
false); //isMulti
 
renderTarget.noMipmap = true;
renderTarget.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
renderTarget.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
renderTarget.wrapR = BABYLON.Texture.CLAMP_ADDRESSMODE;
renderTarget.textureFormat = BABYLON.Engine.TEXTUREFORMAT_LUMINANCE;
renderTarget.hasAlpha = false;
renderTarget.gammaSpace= false;
 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

My wild guess is that the constructor doesn't pass textureFormat to _renderTargetOptions

this._renderTargetOptions = {
                generateMipMaps: generateMipMaps,
                type: type,
                samplingMode: samplingMode,
                generateDepthBuffer: generateDepthBuffer,
                generateStencilBuffer: generateStencilBuffer
            };
Link to comment
Share on other sites

Nope unfortunately.

RTT can be int, half, float but you cannot define the format (always RGBA)

if you want to, you can create a feature issue on our repo as I think it could be a good idea to support this use case

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...