My game have a tiled 2d map. This is a scene screenshot:
I found when I move the camera vertically, there are strange white lines randomly appeared between randomly tiles, See:
I don't know why....
PS: This is a pixel style 2d game, so my texture's filter mode is "Point".
PS: I uploaded this test scene at https://dl.dropbox.com/u/53858613/Web/Web.html , Hold the left mouse button , camera will move downwards, then you'll see white lines randomly.
Change your materials shader to something more suited for 2D. Such as sprite/default.
I made a quick test project and changing the shader from "diffuse" to "sprite/default" solved the issue.
What fixed it for me is setting the compression for my 2D spritesheet to point instead of bi-linear
I do not see this issue on my machine with your example project.
It seems just fine.
1) Make sure there is no white line in the actual image.
2) Make sure resolution options are not an issue.
3) I am not 100% sure but in the skybox the same happens with BLACK lines. Try and change the texture's texture mode to Clamp if possible. This might resolve the issue.
Hope this helps,
-Smileynator
According to this Tilemap tutorial by Brackeys, try turning off antialiasing under Edit>Project Settings>Quality>Anti Aliasing.
Related
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.
I use QPainter and the function drawImage to draw an airplane on a map. The image and redrawn each time the position of the airplane changes. The problem is, after some time, the image becomes extremely pixelated. I have tried to use a high quality .svg and that did not help either.
Below is my code. Can somebody spot where the error is or what has caused the image to be so pixelated?
// Load .svg image
airplane->load("AirplaneTopDown.svg");
// Downsize image
airplaneSmall = airplane->scaled(120, 120,Qt::KeepAspectRatio);
// Rotate image by trans
airplaneSmall = airplaneSmall.transformed(trans);
// Draw image and center at a certain screen position
painter.drawImage(airplaneX-airplaneSmall.width()/2,airplaneY-airplaneSmall.height()/2,airplaneSmall);
Below are the images of the drawn airplanes. One taken as screenshot at the beginning of the program runtime another one taken after a couple of minutes.
Airplane
Airplane-pixelated
One of your problems is that you first rescale the image and then rotate it.
The rotation needs to interpolate new pixels from the old ones. The higher the resolution of the input, the better the quality of the interpolation. The quality of your SVG is completely lost after the rescale operation.
The second problem you are facing is that you use the "fast" (default) transformation method. This method does not antialias. So instead of interpolating from several input pixels, it will only take one best fit. Calling transformed() with the second argument Qt::SmoothTransformation and scaled() with the sceond argument Qt::SmoothTransformation |Qt::KeepAspectRatio` will greatly improve your results.
However it is also slower, as is performing the rotation on the image in its original, higher resolution.
The arguably best solution to your problem is to take on a different approach. Instead of loading the SVG into a QImage, which is a raster-based image, you should work with the vector graphics. So the SVG is rendered in the right orientation and scale in the first place. A good starting point is the SVG Viewer Example: http://doc.qt.io/qt-5/qtsvg-svgviewer-example.html
I have an SCNNode that has its geometry populated from a collada file (.dae) and displays correctly on screen. I can apply materials to the geometry easily enough, however I'd like to change the scale of the material.
I currently populate it with
nodeArray[0].geometry?.firstMaterial!.diffuse.contents="wood.png"
but the scale of the material is too small. While I can edit the png in GIMP or something similar and import it as wood2.png is there any way I can set the material scale programatically?
what do you mean by "too small" ?
Geometries are made of different sources such as the vertices' positions, but also their texture coordinates. These texture coordinates (they belong in [0,1]x[0,1]) are specified per vertex and indicate where to look in the texture.
In your 3D modeler please check that your texture coordinates match what you want (i.e. they cover the whole image i.e. they go from 0 to 1 in very direction), and make sure that your image has no extra transparent margin or other wasted space.
You can have a look at SCNMaterialProperty's contentsTransform property. But please check your model and texture before using it.
You need to open your UV snapshot in an image editing software like Photoshop, scale the wood texture in Photoshop over your UV's, then resave your PNG/JPG, move PNG/JPG back to Xcode
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.
I'm currently working on a WYSISYG editor that allows the user to move, resize and rotate shapes by directly manipulating them. The resizing seems to be fairly complex when the shape is rotated. I got this working for non-rotated shapes, but it will take some trigonometric calculations to resize shapes that are rotated. The registration point is always is the middle of the rectangle because this makes rotating a lot easier.
Before I start implementing this, I was wondering if anyone knew of any libraries or sample source code that does this, or could share some tips and tricks to calculate the transformations.
I have the following parameters:
rotation (in degrees)
width, height
x, y
mouseX, mouseY
I attached a screenshot of what I'm trying to accomplish and another one that has some lines drawn onto it that should allow me to deduct the trigonometric calculations. The cross is the cursor.
alt text http://www.herrodius.com/images/resize.jpg
alt text http://www.herrodius.com/images/resize_lines.jpg
You might look at flex-object-handles, in particular the more recent version 2.
I recommend Transform Manager - http://www.greensock.com/transformmanageras3/
It's actually not that hard. Use the mouse coordinates (mouseX / mouseY)from the rotated display object and they will be transformed for you!