3d

Calculate if two 3D triangles are on the same plane

旧时模样 提交于 2020-01-02 06:21:09
问题 For a 3D game engine I'm working on I need to calculate if two 3D triangles are on the same plane to display it accordingly. How do I calculate the angles of a triangle in 3D space? Would calculating a surface normal and comparing those ever give me 2 equivalent normals? 回答1: Why do you want to do that? What is the number of triangle you expect to test? It seems a little bit complex for a real time rendering algorithm! Anyway: Compute the normal n of the triangle. Then compute the plane

Getting basic 3D models into an OpenGL app

牧云@^-^@ 提交于 2020-01-02 05:28:05
问题 Ok... I'm doing simple OpenGL ES programming and when I say simple, the most complicated things I do aren't much more than glorified beveled cubes and L-shapes. (Think very Tetris but in 3D.) However, getting all that vertex data into an app is either a) hand-coded (UGH!) or b) 3rd-party game engine (double-UGH!!!) or you use some 3rd-party filetype importer. (Partial Ugh!) With one exception. I've been using a program on the Mac called Cheetah3D which is a pretty good modeler (not great, but

Vertex Buffers in opengl

给你一囗甜甜゛ 提交于 2020-01-02 05:24:10
问题 I'm making a small 3d graphics game/demo for personal learning. I know d3d9 and quite a bit about d3d11 but little about opengl at the moment so I'm intending to abstract out the actual rendering of the graphics so that my scene graph and everything "above" it needs to know little about how to actually draw the graphics. I intend to make it work with d3d9 then add d3d11 support and finally opengl support. Just as a learning exercise to learn about 3d graphics and abstraction. I don't know

WPF 3D textures with alpha channel

余生颓废 提交于 2020-01-02 05:15:12
问题 With WPF 3D, is it possible to have a texture with an alpha channel? I am wanting to make a 3d scene where everything is flat surfaces (like everything is paper cutouts). I thought the easiest way to achieve this would be to create a plane, divide it into quite a few triangle (like a cloth), then apply a texture with a transparent background. This way I could use the same geometry and just swap out the texture to get completely different shapes. I tried adding a PNG with a transparent

How to merge adjacent coplanar faces on a mesh

佐手、 提交于 2020-01-02 05:07:15
问题 I am looking for a method / algorithm that will allow me to merge several adjacent coplanar faces on a 3d mesh into a single face. I am hoping that this will optimize my mesh generation program, because right now it generates many 'little' triangles. When I look at the final 3d object on the screen, I can see that they all are oriented in the same direction and they could be replaced with one bigger triangle that encompasses the whole lot! I hope that is clear what I am trying to do. Thanks

How to render a 3d cube in LWJGL?

≡放荡痞女 提交于 2020-01-02 04:54:08
问题 I can`t find a good tutorial on the web, about rendering a 3d cube in the Lightweight Java Game Library! I have been learning LWJGL for some time now. I know how to draw 2d objects. Could Somebody Help me? 回答1: Here is a lesson of a tutorial for "normal" OpenGL but in the bottom of the site you can find code for the tutorial lesson in plenty of different languages and libraries, including Java with LWJGL. To get the java code out of this jar you can open it with e.g. 7-zip and find the .java

Why does this 3D CSS overlap instead of clip?

让人想犯罪 __ 提交于 2020-01-02 02:11:14
问题 Why do these 3D CSS planes overlap in Firefox and Chrome and not in Safari? http://jsfiddle.net/yNfQX/6/ ..and how do I make it behave like safari? Safari & Firefox Preview 回答1: Looks like a bug... from https://bugzilla.mozilla.org/show_bug.cgi?id=689498: Bug 689498 - Intersecting planes are not z-ordered properly Alistair MacDonald 2012-04-12 12:22:25 PDT Safari & Mobile Safari no longer have this problem. The problem still exists in Chrome and Firefox. Broken: Firefox 14.0a1 (2012-04-12)

Robust polygon normal calculation

﹥>﹥吖頭↗ 提交于 2020-01-02 01:22:11
问题 is there a good robust algorithm to calculate normal vector of a convex polygon (in 3D, of course)? For triangles, it is easy: one takes two of the triangle's edges and calculates the cross product: vec3 u = point[0] - point[1], v = point[0] - point[2]; vec3 n = normalize(cross(u, v)); But this approach does not really extend to polygons very well. Some edges of the polygon can be nearly or "exactly" collinear (this will happen often in meshes where T-Junction removal took place), therefore

Flat shading in LibGDX

泄露秘密 提交于 2020-01-01 23:17:12
问题 I am currently working on a simple game and I would like to my terrain to be flat shaded. My terrain currently looks like the following: As you can see the colours blend toghether depending on the vertice colours. I would love for my end product to resemble the following: So I was wondering how can I achieve this? What are the steps to go from gouraud shading to flat shading? Here is how I go about creating the vertices I give to my mesh: public TerrainChunk() { buildHeightmap(); buildIndices

Flat shading in LibGDX

北城余情 提交于 2020-01-01 23:17:09
问题 I am currently working on a simple game and I would like to my terrain to be flat shaded. My terrain currently looks like the following: As you can see the colours blend toghether depending on the vertice colours. I would love for my end product to resemble the following: So I was wondering how can I achieve this? What are the steps to go from gouraud shading to flat shading? Here is how I go about creating the vertices I give to my mesh: public TerrainChunk() { buildHeightmap(); buildIndices