2D Grease Pencil layer problem and render issue - 2d

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.

Related

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

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.

How is the light source given in some OpenGL examples created?

I have seen some OpenGL examples where a light source is shown. eg .
I understand the code required to get this kind of lighting effect in my scene, but how is that light source (visible in the top left corner in the example) created here ? Do I need to enable some flag to show the light source as well ?
There is no setting/flag to automatically show a light source. You have to render it just like anything else in the scene.
The light source in the example you show looks like it consists of 4 triangles for the outside, and another quad (2 triangles) for the surface that emits the light. You can render these triangles with exactly the same mechanisms used for rendering the cube in this scene, or anything else. Build a VBO with the vertex data, and draw the geometry, with transformations applied if necessary.
Yes, this means that you may use a light source to render a light source. While that may sound strange, it makes complete sense. Once you look at the light source as a geometric object, you can apply lighting to it like you would for all your other objects. At least in this example, the outside polygons of the light source look lighted, while the surface emitting the light looks flat white.

How to pan beyond the scrollbar range in a QGraphicsview?

I am building a node graph in a QGraphicsView and I am currently implementing panning.
I used the following question "how to pan images in QGraphicsView" to start but the panning is limited by the scrollbar range.
I also tried the translate method but it gives the same result. The view is limited to a certain rectangle.
I would like to pan without limits, the graph can becomes quite large and it is useful to be able to work in different area of the scene (one graph here, another graph over there, etc).
If you take a look at this video, at the 3 minute mark you'll see the demonstration panning the screen. The application here is one I developed and although it doesn't show it, the real estate of the board appears limitless when panning.
What I did for this was to create a QGraphicsScene of 32000 x 32000 and start the application with the view at the centre of the QGraphicsScene. The test team spent ages trying to pan to the edge of the graphics scene and everyone gave up before getting there - perhaps the scene could have been smaller!
The scroll bar policies are set to off and translation is done by moving the QGraphicsView via its translate function, passing in the delta of either touch, or mouse movement that is applied in the mouseMoveEvent.
Done this way, you need not worry about exceeding the scroll bar range and there was no problem creating a very large QGraphicsScene as it's just a coordinate space.
I came across the same issue. However, setting the scene to something big and leaving it I do not think is the best option. I have developed a dynamic way of changing the scene size so it lets you move freely. You can find it in this other stack overflow answer.
You want to plot graphs. Try out this Qt library - QCustomPlot , it will save you hours of hard work.

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.

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