Hi Friends, I am working on a Web Based Flex project which is being used to generate 3D animation of 3D Objects. The application has a Work Area where 3D objects are created and there are panels like Properties, Transform, etc to manipulate the size, texture, alignment, etc properties.
The 3D objects can have an Image Texture or a 2D Shape Texture. For creating 2D texture, the application provides a predefined set of 2D shapes (Circle, Triangle, Rectangle, etc.). When a user drags or double clicks any of these Predefined shapes, the application creates a 2D vector shape (hidden 2D pane) and applies color, stroke, corner rounding and other properties. Now as soon as the 2D vector shape is ready for use (on UpdateComplete event), the application captures a BitmapData snapshot of the shape and use the captured BitmapData snapshot as the texture for the new 3D object being created in the 3D pane. The same workflow is followed when the 3D object (with 2D texture) properties are manipulated.
The whole workflow is working perfect. But there is one strange issue related to the quality of the texture edges. Please see in the attached screenshot, the Circle shape at the Top-Left corner represents the Bitmap data of the Circle shape (created as 2D Shape in the hidden 2D layer) and the Circle with selection handles, represents the same Bitmap data but rendered in 3D pane as the texture of the 3D object. You can see that the 3D rendering of the same Bitmap is showing Steps on the edges where there is rounding. The same Bitmap appears smooth in the 2D pane, when I set it to visible, as being shown in the screenshot.
Below is the peace of code, which applies the BitmapData as the texture to the 3D object,
texMat = new TextureMaterial(new BitmapTexture(textureBitmap));
texMat.smooth = true;
texMat.mipmap = true;
texMat.alphaBlending = true;
texMat.alphaPremultiplied = true;
texMat.alpha = 0;
texMat.alphaThreshold = staticThreshold;
I have been trying to fix this texture edge related issue by manipulating these TextureMaterial parameters, but I am not getting positive result. Is there any specific parameter/property, which I need to set? Have any of you faced similar issue before? Any suggestion, guidance would be a great help.