Three.js buffergeometry disappears after moving camera to close - camera

My buffergeometry disappears after moving the camera to close. You can also see that in drawcalls Three.js example that has TrackballControls. In my case it's alot worser. My points disappear at the distance from 0 to 400 and my lines disappear at the distance from 0 to 100. My objects are working fine with a simple geometry but not with a buffergeometry. I found out that it has something to do with the centroid of the buffergeometry. I tryed to use different camera's, to change the camera range and still it doesn't work. How can I stop my objects to disappear after moving the camera?
Update
Got it working by adding linesMesh.frustumCulled = false; and removing geometry.computeBoundingSphere();. Thanks for all the help.

Three.js thinks your object is outside the frustum. Add the line
linesMesh.frustumCulled = false;
and it should stop it from disappearing.

I suggest that you check your camera's .near clipping parameter. Objects close to the camera will naturally be cut off.

I had a similar issue with BufferGeometry and while myMesh.frustrumCulled = false; did solve the issue, so did myMesh.geometry.computeBoundingSphere();

Related

Rigify Animbox addon Armature origin not moving problem

I am using Rigify Animbox when move my Armature and start animation it move last position and when go to edit mode it show many link that connect with Armature.
this link can't set origin or can't move please help me how can fix it.
please see below video so you can better understand my problem.
Link: https://screenrec.com/share/AkR59zCZrL
thanks in advance
You probably have a keyframe in Object mode. That makes the whole armature jump to the center of the world (which is where the keyframe is recorded). Just delete all keyframes on the object level and you'll be able to move the Armature object.

In a basic project, as soon as I move I am teleported below my landscape. What is going on?

I created a blank template and added a landscape.
When I simulate the project, I can look around with the mouse, but as soon as I move with WASD, I am instantly below the landscape. It doesn't fall, so it doesn't appear to be a gravity-related issue, I'm just down there all of a sudden.
Does anyone have any idea what I could have done wrong?
I've not altered any blueprints as far as I'm aware.
Without watching the code is hard to understand what is wrong,but check this:
In the code/blueprint check that when you press input the position is correctly Set (should be like current position + offset based on direction)
Check if your input event is used somewhere else (maybe some uknown behaviour is executed)
I am a numpty. I didn't realise I was working on a map where I'd added a sphere as my sky box, and the collision was turned on, so any movement instantly jumped me down below the bounds of the sphere. Thanks.

Nutiteq map freezing after adding a few lines and markers

im developing a traffic application and there is a few traffic lines and warning markers on the road. I draw traffic lines according to zoom level. For example, If zoom level is over 10, im removing all lines and redraw for new zoom level. Because lines overflow on the road.
I have lines over 400 for every zoom level. So every zoom in/ zoom out action, i remove and redraw. After a while my map begins to freeze and moving very slowly.
Is there any caching operation on background? Because im clearing the map every zoom level. In addition to what I should do to avoid freezing?
public GeometryLayer geoLayer;
geoLayer = new GeometryLayer(new EPSG4326());
line = new Line(arr_lat_long1, label, lineStyle, null); //add lines
line.setVertexList(arr_lat_long1);
geoLayer.add(line);
geoLayer.clear(); //clear layer
EDIT:
I tried mapview.destroyDrawingCache(); , mapview.postInvalidate(); but they doesn't help me. In addition, is there any way to refresh mapview?
It is pretty much impossible to suggest anything without knowing more details. The best idea is to create a issue at https://github.com/nutiteq/hellomap3d/issues and attach a working test case displaying your issue. If it is reproducible, it will be investigated.

libgdx tiledmap flicker with Nearest filtering

I am having strange artifacts on a tiledmap while scrolling with the camera clamped on the player (who is a box2d-Body).
Before getting this issue i used the linear filter for the tiledmap which prevents those strange artifacts from happening but results in Texture bleeding (i loaded the tiledmap straight from a .tmx file without padding the tiles).
However now i am using the Nearest filter instead which gets rid of the bleeding but when scrolling the map (by walking the character with the cam clamped on him) it seams like a lot of pixel are flickering around. The flickering results can get better or worse depending on the cameras zoom value.
But when I use the "OrthoCamController" class from the libgdx-Utilities which allows to scroll the map by panning with the mouse/finger i don't get these artifacts at all.
I assume that the flickering might be caused by bad camera-position values received by the box2d-Body's position.
One more thing i should add here: The game instance runs in 1280*720 display mode while my gamecam renders only 800*480. Wen i change the gamecam's rendersolution to 1280*720 i don't get those artifacts but then the tiles are way too tiny.
Has anyone experienced this issue or knows how to fix that? :)
I had a similar problem with this, and found it was due to having too small a decimal value for the camera position.
I think what may be happening is some sort of rounding with certain tile columns/rows in the tilemap renderer.
I fixed this by rounding to a set accuracy, like so:
camera.position.x = Math.round(player.entity.getX() * scalePosition) / scalePosition;
Experiment with various values, but I got it working by using the tile size as the scalePosition value.
About tilesets, I posted a solution here: Getting gaps between tiled textures with libgdx
I've been using that method with Tiled itself. You will have to adjust "margin" and "spacing" when importing tilesets in Tiled to get the effect working.
It's 100% working for me :)

three.js: how to control rendering order

Am using three.js
How can I control the rendering order? Let's say I have three plane geometries, and want to render them in a specific order regardless of their spatial position.
thanks
You can set
renderer.sortObjects = false;
and the objects will be rendered in the order they were added to the scene.
Alternatively, you can leave sortObjects as true, the default, and specify for each object a value for object.renderOrder.
For more detail, see Transparent objects in Threejs
Another thing you can do is use the approach described here: How to change the zOrder of object with Threejs?
three.js r.71
for threejs r70 and higher is renderDepth removed.
Using object.renderDepth worked in my case. I had a glass case and bubbles inside that were transparent. The bubbles were getting lost at certain angles.
So, setting their renderDepth to a high number and playing with other elements depths in the scene fixed the issue. Hooking up a dat.gui control to the renderDepth property made it very easy to tweak what needed to be at what depth to make the scene work.
So, in my fishScene, I have gravel, tank and bubbles. I hooked up the gravel mesh with a dat.gui control and with in a few seconds, I had the depth I needed.
this.gui.add(this.fishScene.gravel, "renderDepth", 0, 200);
i had a bunch of objects which was cloned from a for loop in random position x and y... and obj.z ++, so they would line up in line.. including obj.renderOrder ++; in the loop solved my issue.