How to draw or plot a mesh using the mouse in JavaFX which can then be textured and deformed? - javafx

I am trying to implement a tool into my application. the tool would allow the user to plot a triangle meshes using the mouse. I have looked everywhere for a way to do this, tutorials, examples, etc and have not been successful. I have seen the FXyz library but that does not really simulate What I am trying to accomplish. The goal of the program looks as follows:
Use Case Sequence:
The user adds a png image to the 3D scene or drags it into the 3D scene using the mouse.
Once the image is being displayed the user would then be able to plot a mesh around the image.
Once the user has finished plotting the mesh. There would have to be a way to add the image being overlayed by the mesh as a texture to the mesh. The image should look the same after being added as a texture. Is this too hard or beyond the scope of what can be achieve in JavaFX?
Theoretically It would then be possible to drag the vertices of the mesh at draggable points and successfully applying transformations to the texture. Would this be possible?
Images showing what I am trying to achieve
As you can see maybe after plotting the mesh the points connecting the vertices can be dragged in order to manipulate or transform the shape of the mesh. If the mesh has a texture over it. would the image then also transform ?
Would this be possible with the TriangleMesh class that JavaFX has which by the way there is very little out there which explains how to use it and how the points, face points and texture points work. Very confusing =(.
Target End Result
My question is would the type of manipulation shown in the image above be possible in JavaFX? Can this sort of functionality be achieved using the TriangleMesh class or other similar class in JavaFX ? As you can see what I am trying to achieve is really image manipulation I would appreciate knowing if there is another better way to do this.
I unfortunately do not have any code I can share. I just cant seem to produce any regarding this task. I am not asking to be given code or for someone to solve the problem for me. I just want to see examples be guided into the right direction on how to do this and to know if it is even possible or should I just give up on it!
If you have read this far Thank you so much for your time I really appreciate it.

I have read your question till the end :-) In contrast to many people here you are at least providing a clear description of what you want to achieve. According to my own experience I would say that what you want to do is easily possible with JavaFX and the MeshView is the way to go here.
You can use your image as the texture for this mesh and you can distort the image by manipulating the vertices of this mesh. I have implemented part of your functionality myself for a project so I know that it works.

Related

2D Grease Pencil layer problem and render issue

Hi guys I have 2 major queries that are stumping me.
I am very new and fresh to blender so reply with that in mind please.
I am currently drawing a 2D character and every time I try to draw on a new layer on the G Pencil stroke layer blender restarts. To work around this Ive added a second g pencil and now I can continue drawing without blender restarting. But now Im unsure of how to place the the layer in front or behind. If i change the plane of the stroke and bring it forward sometimes the drawing glitches out. Changing the hierarchy of the strokes does nothing. What am I missing here. the first stroke does have 100s of layers.
Secondly I am trying to draw a landscape in 2D in a Ghlibi art style. Which to do that Im using the g pencil and changed some of the stroke attributes to say layer the grass for texture in the landscape. Then I reached a point where the stroke would no longer render for me to view what I was doing. Im assuming theres too much detail for my cpu to process Is there a way to flatten the drawing I have done soo far so its easier to render rather than it being an active layer. This is something that you can do in photoshop effortlessly when painting with a brush so maybe Im using the wrong method. Please advise?
Thanking anyone that can help in advance
Im expecting to be able continue the the character whilst being able to select layers at the front or back.
Im expecting to be able to continue drawing the landscape without losing the rendered look so I can see what im drawing.

After Effects Element 3D rotation bug

I don't know how to explain this but the objects I make in ELEMENT 3D aren't 3D but more like 2.5D.
I made a video so you can see the problem.
https://sendvid.com/s1hv1ay3
My recording software didn't record the Element interface at 0:24, but I was trying to show in that interface that you could rotate it without problems.
You're not understanding how Element3D (and aspects of the AE interface) work. Think of the layer you apply it to as being its own window "into a 3D world". You don't rotate the layer itself, you rotate the objects within the Element3D world by changing the parameters in the timeline or Effects controls pane. You were using the rotate tool in the video with the Element3D-effected layer selected. Don't do that. Use the individual parameters within Element. Another way to rotate around the 3D object(s) is to use the camera. I suspect this is what you were attempting after seeing a tutorial or something. What you do is make a two-node camera and use the camera tool by cycling through the tool with the "c" key until you get camera rotate, which looks a bit similar to the rotate layer tool. With a two-node camera, rotating the camera allows you to rotate around the point of interest of the camera so it rotates around the object in 3D space. I suggest you get a more familiar with how 3D works in AE (which is not "true 3D", not 2.5D, but is "Planar 3D"; the Element3D plugin is one of the best 3D-integrated plugins working within this model).
don't ever move the layer the element 3d model is on.
Use the element effects controls (f3). usually found in group 1

three.js skydome with gradient

I would like to add a sphere with a 2d gradient as texture to create a skydome. I read that in openGL this is often solved by rendering the skybox without depthtest in an additonal pass.
I disabled depthTest on my sphere so everything else is drawn in front of it, it's kinda giving me the disired effect but depending on the camera angle it clips through other objects in my scene.
I was looking at several examples which make use of THREE.EffectComposer and a second scene, I may be completely after the wrong thing here but I think that could solve this. The thing is I havent ever touched the effectComposer and have no idea at all how to work with it and which things i exactly need.
I would aprreciate any input on this, maybe I'm after the wrong stuff at all.
Here are two three.js examples in which a skydome with a gradient is created. They do not involve EffectComposer or disabling depth test.
http://mrdoob.github.com/three.js/examples/webgl_lights_hemisphere.html
http://mrdoob.github.com/three.js/examples/webgl_materials_lightmap.html
three.js r.55
You dont have to use a cone or other 3D-geometry to simulate a gradient sky.
I solved it using a canvas (with 3 gradient-spots, lightblue -> white (horizon) -> darkblue) and draw it as sprite in front of my camera with the right distance to it (fog-distance).
You only have to manage the distance when moving/rotating your cam.
Tip: Use mesh.scale.set (xx,xx,1) to zoom the canvas-texture to needed size.

how to render a map defined by a matrix of cells using QT Gui?

I have to render using QT a map defined by a matrix of cells in overview mode (think GPS map). I'd like to be able to zoom on it and each cell is defined by its color and some properties (bitmaps to put on the cell). I also need, like in a GPS, to be able to move around (using the directional arrows) in the map.
Right now, I'm thinking about drawing a matrix of QImages on my screen, and loading each one of them with the info of the cells I need, but it doesn't seem like a very good solution.
Thank you for every possibility you might provide.
Your initial idea is a reasonable one, but put all the QImages and info you need into a custom QGraphicsItem and add them to a QGraphicsScene (and fix their position) - then you only need a QGraphicsView to visualise everything. This way you get the BSP painting and selection optimisations, view transformations, and nice animations (if required!) for free.

Wrapping image around objects in web app

I'm creating a web app in ASP.NET like this one:
http://www.zazzle.com/cr/design/pt-mug
I know how to do everything except wrapping an image around an object.
It would be a simple task to do if I would only have to stack an image on
top of the other, if they were flat, but if it is a round object, as this mug
is, it's kinda tricky.
My first guess was to create some sort of algorithm for GDI+ that would
simulate "wrapping" image around an object (actualy it wouldn't be an 3d object,
it would just be a screenshot of it).
I figured it would be to raw approach and it would result in very bad quality,
if I could ever make it work.
So, my second guess was to implement somekind of 3d renderer to whom I would
give an image map for some object, it would render me that image onto an object
and in real time return me rendered image. Is that posible?
Is there any other way? Where do I start?
If you are willing to try a commercial product, my company makes a raster processing SDK for .NET called DotImage. If you try it, take a look at PolygonTransform. You supply a polygon as a list of points, and the class warps the image to fit inside the polygon. If you need sample code for it, let me know.
It might be some sort of OpenGL 3D rendering, but an image could easily be morphed in a purely 2D way for this effect. Horizontally, it would need to be squished where it goes off the side of the cup. Each column of pixels needs to be shifted vertically by varying amounts depending on which column - such that a horizontal line the image would become like a "U" shape. With the right parameters, such a morph could mimic the proper 3D shape. Lighting effects could be applied to, by brightening/darkening the image a bit in the right places.

Resources