I have a texture I want to use for a TriangleMesh (it's a simple cube). Some parts of the texture are transparent. When I put the texture on the mesh, it's black. Is there a possibility to change that? I would like to make it transparent.
Appreciate your help, thanks
Transparency in JavaFX 3D shapes has been a long time request... until recently: Since JDK8u60 early access release b14, transparency is enabled in 3D shapes.
You can add color with transparency as diffuse color, like in this answer.
Also you can add images with some transparency level on every pixel, like this one:
where this is the image used with 50% transparency:
And you can use full transparency areas too. For instance, in this image, Duke has 50% transparency and the rest is 100% transparent:
Giving this result applying that image as diffuse map over the cylinder:
Have a look at FXyz project for more details on creating 3D shapes and using textures in many different ways, and the FXyz Sampler.
Related
I'm using the GraphicsContext of a JavaFX Canvas to draw gradients (linear as well as radial), some times using the alpha channel to layer gradients on top of each other. But since the color resolution is so low (8 bits per channel), I have very obvious and annoying banding artifacts on each and every one of the gradients, for instance as shown in the image below.
I would like to increase the color resolution so that the banding disappears. If that is not possible, I would be eager to know if there are different Java-compatible APIs/frameworks for creating 2D drawings - I don't need UI stuff, I just want to draw, display, and save images.
Thanks in advance for any useful advice!
I need create clickable component with custom shape. Appearance is set by svg file. Clickable area must be constrained by svg shape. I find great example of what I need, but it use pixel mask or circle mask. Can you help me find solution?
Most probably you will need to create a pixel mask yourself from the SVG shape.
The question is how to approach this. Qt does not offer a simple way of doing it. However, in Qt you can render the SVG offscreen into an image that you initialize with transparent pixels or a color key. You can then use this image as a mask.
If the size of your viewpoint changes frequently, you might want to do the mask rendering in a higher resolution first and then scale it down accordingly for performance. Also note that if your SVG is animated, you would have to accomodate for that.
Or you might use a different library than Qt to obtain the mask. Also, if your SVG contains only a single polygon, you might go for a point-polygon test. But I doubt it, and such a test is also not trivial when the polygon is non-convex (you typically end up with a scanline algorithm anyways).
I would like to draw a cross over an image, with a different color for each pixel depending on the background color, so that the cross is always well visible. So I'm trying to change the Composition Mode of the QPainter, but I can't find an acceptable solution.
I have tried QPainter::CompositionMode_Difference, painting with white. This is quite good because it inverts the destination color, but it doesn't work well if the destination color is a middle gray or similar.
The best solution is to get white if the background is "dark" and black if the background is "light". Is there a way to get this effect using only composition modes of the painter?
What about running the Image Composition Example for yourself, and maybe modifying the source/destination images to better fit your scenario? Maybe QPainter::CompositionMode_Xor is what you want?
An alternative solution, which is even very simple, is to use a white cross with a rather thick black outline. In this case you can ensure the visibility of the cross even in case of rather dark or light background images.
I am building the basic Set card patterns. I can do colours, numbers and fillings, and I have the diamond and oval shapes. Please see my progress in this fiddle.
The last piece of the puzzle is to build a squiggle class for the "squiggle" shape. How can I do the squiggle shape using CSS?
I'm pretty sure you'll have to resort to SVG for shapes like that.
SVG might also make your life easier for those other shapes too. On my Safari 6.0.2 I see a few small CSS rendering artifacts:
In particular, the spacing of the striped diamond due to how transform works (texture mapping) produces something that doesn't quite look completely uniform. You'll need to scale up this screenshot to see the artifacts at the corners of the diamond.
Basically, CSS is not meant for drawing shapes. SVG is meant for drawing shapes. Therefore since you are trying to draw shapes, there's a much higher chance you'll succeed with SVG.
Good job with the diamonds, though. (Note also SVG ought to work on platforms not supporting CSS3 3D; it is a neat trick to skew/scale square to make a diamond but at the end of the day its more or less a hack)
I am drawing three circles in my flex application, using actionscript. But these circles are now pure 2D images, which is not looking good. How can I make it look like 3D using some shadows or shades inside the shape.
Cheers,PK
If you want some 3D-ish effects, you should look into the usage of the bevelFilter. I have found some links that show you how you can use this filter:
http://www.republicofcode.com/tutorials/flash/as3filters/
http://wonderfl.net/c/6AxW
http://www.flashactionscripttutorials.com/?p=projects&actionscript-functie=applyFilter
If you want genuine 3D-objects, you should use a 3D-library (I would recommend Away3D).