How do I transform a Unity3d camera's view frustum so that I can pass in a Plane and have the camera's near clipping plane become that plane? The plane might not be perpendicular to the looking direction. I am not familiar with the Matrix4x4.
image
I am not interested in a solution involving applying a material with a custom shader to every object in my scene.
Thanks for any help!
Related
What's working:
I have a solution for loading in topography using terrain tiles. Each tile occupies a plane as mesh. The image on the plane can then be any map tile source. Each plane mesh is a child of an object3d and offset accordingly to create the overall terrain.
The Question:
I am not sure the best way to go about having an irregular shape inherit 3d surfaces. This shape could be drawn or imported as KML. Is there a way to use a vertex shader to inherit the topography? I would like the topography as a mesh so that I can interrogate the topography of the shape. In this way it is different from using a shader to paint the surface as a mesh result is needed.
I do not yet have code for this to share as I do not know where to start. Vertex shader? Constructive solid Geometry?
I have a 2D plane with a tree texture that always faces the general direction of the camera by rotating only on its Y axis. It works great and the shadows are cast perfectly, but I don't want the shadow of the 2D plane to rotate with it.
I'd like the shadow to appear so that the 2D object is always facing directly at a light source even when its not. I've tried messing with shaders without any luck. Should I be investigating shader tricks with this, or is there already something available from within Three.js that can do this already?
I was thinking it's that or come up with an invisible plane at the same position of the other 2D plane, and force it to face the light source and cast shadows, but that would cause other complications.
The reason for needing this is to keep thick, bushy shadows for 2D trees in a scene.
In OpenGL Geometry is always clipped against the boundaries of a six plane frustum in x, y, and z. Three.js57 also have the Frustum with six plane. I want know how to achieve clip
the mesh in three.js using three.js frustum
Thanks in Advance
I've found the following parameter in the three.js documentation. It seems that geometry will be checked against the frustum by it.
http://threejs.org/docs/#Reference/Core/Object3D
If .frustumCulled is set to true, it checks every frame if the object is in the frustum of the camera.
Using a basic THREE.PlaneGeometry and Orbit and Pan controls.. for some reason when I look at the underside of the plane, the plane vanishes from the scene. Is there some way that I could look at the underside of the PlaneGeometry?
I want to realize a 3D interactive globe with three.js and I wonder if there is a way to intersect over Sprites primitive with the Raycaster?
If you check the source code for RayCaster at
https://github.com/mrdoob/three.js/blob/master/src/core/Raycaster.js
it would appear that the intersectObject function only checks objects that are instances of THREE.Particle or THREE.Mesh, not THREE.Sprite. Possibly this is because sprites could be set to use screen coordinates, and so a ray that projects into your 3d scene wouldn't make sense in this situation, or if placed in the scene as the sprite image always faces the camera, it doesn't act like your standard 3d mesh.
Perhaps you could attach a PlaneGeometry or a very thin CubeGeometry to the position of your sprite, set its rotation to the rotation of the camera so that it is always parallel to the view plane of the camera like the sprite is, and then check for intersections with the mesh instead?