rockefeller Posted March 3, 2018 Share Posted March 3, 2018 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 }; Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 5, 2018 Share Posted March 5, 2018 textureFormat is a read-only parameter after the texture was created. You can create a raw texture of type BABYLON.Engine.TEXTUREFORMAT_LUMINANCE using BABYLON.RawTexture.CreateLuminanceTexture(...) would that be helpful? GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
rockefeller Posted March 5, 2018 Author Share Posted March 5, 2018 Can I use raw textures as rendertargets? if not, it doesn't help me much Quote Link to comment Share on other sites More sharing options...
Guest Posted March 6, 2018 Share Posted March 6, 2018 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 Quote Link to comment Share on other sites More sharing options...
rockefeller Posted March 7, 2018 Author Share Posted March 7, 2018 Done, here's the issue https://github.com/BabylonJS/Babylon.js/issues/3901 RaananW 1 Quote Link to comment Share on other sites More sharing options...
Guest Posted March 8, 2018 Share Posted March 8, 2018 Will work on it asap! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.