Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lines disappear prematurely when they clip the bottom center of the camera #7

Closed
D1plo1d opened this issue Jul 8, 2010 · 9 comments
Labels

Comments

@D1plo1d
Copy link

D1plo1d commented Jul 8, 2010

When I zoom into a object (which I do by incrementing the z vector of the camera position in three.js) I find that once I get to close lines start disappearing while they should still be in the viewing area. Perhaps this is a problem with my near clip (0.000001) or far clip (1000000) being set poorly (those values were based on no real 3d programming experience) but it could also be a bug so I'm posting it here in hopes of some help with the issue.

The lines in the screenshots bellow use THREE.ColorStrokeMaterial and have overdraw set to true (btw. what does overdraw do?). I've drawn a 2d grid with a part on it (this is part of some CNC software I'm working on) but as you can see the grid lines that intersect the bottom of the camera are disappearing as i zoom into them.

A few screen shots of the problem (zooming into the object by incrementing camera.position.z): http://imgur.com/a/JA9ET/threejs_lines_disappearing_due_to_camera_clip_issue

Any advice on how to solve this problem would be greatly appreciated!

@D1plo1d
Copy link
Author

D1plo1d commented Jul 8, 2010

update: although i didn't zoom in far enough to see it this has the same effect on the part's lines (since they are smaller i need to zoom in more to intersect them with the camera)

@D1plo1d
Copy link
Author

D1plo1d commented Jul 8, 2010

forgot to add one critical detail, I'm fairly certain this is all going through the canvas renderer - the browser is Chrome 5.0.375.70 (48679) Ubuntu.

@mrdoob
Copy link
Owner

mrdoob commented Jul 8, 2010

I can't seem to be able to open imgur images today... But I think I know what you mean.

This is because one of the points of the segment is outside the frustrum. That doesn't happen with the WebGLRenderer, but with the CanvasRenderer/SVGRenderer it needs a feature that I haven't had time to implement.

Frustrum Clipping
http://blog.zupko.info/?p=170

Feeling like tackling this one? :)

PS: Overdraw extends the screen space positions of the vertices to avoid the antialias gaps between polygons that (unfortunately) all the browsers show. Each vertex is separated from the other 2 (or 3) by 0.5 pixels. It would be great if had a antialias = false option, but they decided not to put it. Actually. overdrawn shouldn't be an option on the StrokeMaterials as it's not an issue there. Will fix.

@mrdoob
Copy link
Owner

mrdoob commented Jul 8, 2010

Specifically, the feature needed is FrustumClipping.NEAR. Which, may be a good idea to include by default on CanvasRenderer and SVGRenderer.

@mrdoob
Copy link
Owner

mrdoob commented Jul 8, 2010

Thinking about it again, the Renderer class should be the one that does that. So it would split a polygon if needed, letting the CanvasRenderer and SVGRenderer just draw. If that's in place maybe CanvasRenderer/SVGRenderer wouldn't need to do 2d clipping...

@D1plo1d
Copy link
Author

D1plo1d commented Jul 8, 2010

ok, good to know I'm not crazy, I'll take a look at FrustrumClipping.near later on and see if i'm up to it. Thanks again :)

@jurjen
Copy link

jurjen commented Jul 10, 2010

I believe this would also fix the issue with intersecting planes?
I've modified the cube demo to spin in both the x and y axes, and when it intersects with the plane underneath, you get interesting rendering, where I think the foremost triangle is drawn over the top, and isn't clipped on the intersection line... If you change the number of segments used for the plane, the effect changes as well (more triangles, more intersections).

@mrdoob
Copy link
Owner

mrdoob commented Jul 10, 2010

You mean when 2 objects "collide"? I think that's a different issue. Also hard to nail. There is some good "reading" here:

http://away.kiev.ua/away3d/techdemos/zorder/

@mrdoob
Copy link
Owner

mrdoob commented Nov 21, 2010

mrdoob pushed a commit that referenced this issue Apr 7, 2015
godlzr pushed a commit to godlzr/three.js that referenced this issue Feb 7, 2017
add falloff for diffuse, opacity, map and alpha.
threejsworker pushed a commit to threejsworker/three.js that referenced this issue Feb 27, 2017
threejsworker pushed a commit to threejsworker/three.js that referenced this issue Feb 27, 2017
mrdoob pushed a commit that referenced this issue Dec 17, 2018
mrdoob pushed a commit that referenced this issue Apr 7, 2019
moraxy pushed a commit to moraxy/three.js that referenced this issue Aug 17, 2019
Rename fogExp parameter to fogExp2
3jsLive pushed a commit to 3jsLive/three.js that referenced this issue Feb 4, 2021
3jsLive pushed a commit to 3jsLive/three.js that referenced this issue Dec 10, 2021
3jsLive pushed a commit to 3jsLive/three.js that referenced this issue Aug 8, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants