Skip to main content
Jonathan S.'s user avatar
Jonathan S.'s user avatar
Jonathan S.'s user avatar
Jonathan S.
  • Member for 3 years, 7 months
  • Last seen more than 1 year ago
awarded
comment
How to map texture pixels to the corresponding 3D positions?
I sadly don't know of any good references. You might be able to do this using the texture coordinate derivatives. Build two base vectors for the triangle's plane, one in increasing U direction, one in increasing V direction. You can then use these vectors to build a 2D grid that you can step through and get the coordinates of every texel.
revised
Loading…
Loading…
comment
How to map texture pixels to the corresponding 3D positions?
What do you need this for? There's not necessarily a defined mapping between texture pixels (texels) and 3D coordinates. A single texel may map to zero, one, or an arbitrary number of points in 3D space.
comment
Formula for attack range using hexagons
hexagon_distance is a function, you give it the positions of your attacker and defender and it gives you back the distance between them - that is, the number of hexagons on the shortest path between attacker and defender. ("Distance" doesn't always have to be the euclidean distance, it can be defined differently too.) You can then compare the returned distance against the maximum distance, just like you did with point_distance. You will also have to translate the code into whatever programming language you're using because what I wrote is in C++.
awarded
awarded
revised
Formula for attack range using hexagons
Add an explanation of the algorithm
Loading…
answered
Loading…
awarded
comment
awarded
answered
Loading…
awarded
comment
OpenGL height map accuracy for planetary rendering
What specific pixel format are you using? And what's the resolution of your floating-point texture? What happens if you increase that resolution? How are you computing the contents of the texture?
comment
Find out triangles that are not occluded from a camera view?
I don't think you can handle the "triangle smaller than a pixel" case without spending a lot of computation time on them, sadly. What you can do, however, is to post-process the results and also select all triangles that are completely surrounded by visible triangles, for example. Another work-around would be to increase the resolution for this visibility-test rendering pass. A combination of both will probably give the best results.
comment
How to calculate ray unit grid intersections?
Not a full answer either, but this video might help. youtube.com/watch?v=NbSee-XM7WA
Loading…