angus.wood Posted December 11, 2014 Posted December 11, 2014 (edited) I am working on in-game screens, where I take an image from a WidgetSpriteViewport and use imageTextureImage() to set the diffuse texture of an ObjectMeshDynamic. When the object is close to the screen it works as expected. However when the camera moves a short distance from the object the texture fades out and is replaced with a static texture. I would like to not fade out. I have tried .setMaxFadeDistance(9999.0f,0) and .setMaxVisibleDistance(9999.0f, 0) but they do not seem to have any effect. The code that sets the texture in update() is image = new Image(); wsv.renderImage(image); mat = omd.getMaterialInherit(0); index = mat.findTexture("diffuse"); mat.setImageTextureImage(index, image, 1); Edit: it appears that the texture size is a key factor. Larger textures fade to static more quickly than smaller textures do. Edited December 11, 2014 by angus.wood
silent Posted December 11, 2014 Posted December 11, 2014 Hi Angus, Could you please provide a simple test scene? Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
angus.wood Posted December 11, 2014 Author Posted December 11, 2014 Ok. A test scene is attached. mup2p.zip
unclebob Posted December 11, 2014 Posted December 11, 2014 Thanks, Angus! I'll have a look and report back. Also, try to use .setMaxFadeDistance(INFINITY,0) instead of .setMaxFadeDistance(9999.0f,0) and the same for setMaxVisibleDistance.
unclebob Posted December 12, 2014 Posted December 12, 2014 Hey Angus, Looks like "meshes/Plane-mesh.mesh" is missing in your archive. Could you please add it to your test scene and upload it again?
angus.wood Posted December 15, 2014 Author Posted December 15, 2014 Hey Angus, Looks like "meshes/Plane-mesh.mesh" is missing in your archive. Could you please add it to your test scene and upload it again? Sorry about that. An updated .ZIP is attached. mup2p.zip
angus.wood Posted December 15, 2014 Author Posted December 15, 2014 Solved! The issue is related to mipmaps. The "fade out" that I was seeing is (we think) a lower resolution mipmap taking the place of the dynamically created texture. So by adding the line image.createMipmaps(IMAGE_FILTER_BOX, 1.0f); to the code means that the texture is now all correct.
Recommended Posts