• 9
• 9
• 11
• 12
• 9
• ### Similar Content

• Good evening everyone!

I was wondering if there is something equivalent of  GL_NV_blend_equation_advanced for AMD?
Basically I'm trying to find more compatible version of it.

Thank you!

• Hello guys,

How do I know? Why does wavefront not show for me?
I already checked I have non errors yet.

And my download (mega.nz) should it is original but I tried no success...
- Add blend source and png file here I have tried tried,.....

PS: Why is our community not active? I wait very longer. Stop to lie me!
Thanks !

• I wasn't sure if this would be the right place for a topic like this so sorry if it isn't.
I'm currently working on a project for Uni using FreeGLUT to make a simple solar system simulation. I've got to the point where I've implemented all the planets and have used a Scene Graph to link them all together. The issue I'm having with now though is basically the planets and moons orbit correctly at their own orbit speeds.
I'm not really experienced with using matrices for stuff like this so It's likely why I can't figure out how exactly to get it working. This is where I'm applying the transformation matrices, as well as pushing and popping them. This is within the Render function that every planet including the sun and moons will have and run.
if (tag != "Sun") { glRotatef(orbitAngle, orbitRotation.X, orbitRotation.Y, orbitRotation.Z); } glPushMatrix(); glTranslatef(position.X, position.Y, position.Z); glRotatef(rotationAngle, rotation.X, rotation.Y, rotation.Z); glScalef(scale.X, scale.Y, scale.Z); glDrawElements(GL_TRIANGLES, mesh->indiceCount, GL_UNSIGNED_SHORT, mesh->indices); if (tag != "Sun") { glPopMatrix(); } The "If(tag != "Sun")" parts are my attempts are getting the planets to orbit correctly though it likely isn't the way I'm meant to be doing it. So I was wondering if someone would be able to help me? As I really don't have an idea on what I would do to get it working. Using the if statement is truthfully the closest I've got to it working but there are still weird effects like the planets orbiting faster then they should depending on the number of planets actually be updated/rendered.

• Hello everyone,
I have problem with texture

• Hello everyone
For @80bserver8 nice job - I have found Google search. How did you port from Javascript WebGL to C# OpenTK.?
I have been searched Google but it shows f***ing Unity 3D. I really want know how do I understand I want start with OpenTK But I want know where is porting of Javascript and C#?

Thanks!

# OpenGL Per triangle normals generating..

This topic is 1841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello there, i have small problem with normals for terrain generated from heightmap. I'm trying to generate normals for it, and its almost working, but i'm getting very strange result ( there are strange stripes everywhere ;f) :

Code for generation normals :

glm::vec3 x6ngine::cHeightMap::computeNormal(glm::vec3 v0, glm::vec3 v1, glm::vec3 v2)
{
return glm::normalize(glm::normalize(glm::cross(v2-v0,v1-v0)));
}


i dont know where's problem ;/ somewhere in opengl code?, or i'm just generating it wrong? Thanks for help. Regards x6itru.

##### Share on other sites

Normalizing 2 times is useless. You need to calculate vertex normals by assigning them an average of all surface normals of adjacent quads to not have those sudden changes.

##### Share on other sites

I've normalized it twice by accident thanks for help, it should look smoother with per vertex normals.

Edited by x6itru

##### Share on other sites

hello again ;/

I have really strange problem with vertex normals.

result :

code for compute vertex normal :

Result is very strange ;/ There are strange small "holes" - ofc they're from normals, terrain grid is smooth, so normals should be smooth too. ;/

Edited by x6itru

##### Share on other sites

Looks about right. Terrain with smooth normals and not per-pixel normals will still not look perfectly smoothed.

you are setting sum to 0 somewhere else I assume? Math looks fine.

##### Share on other sites

Yes of course i'm setting sum to 0, can you tell me something more about per-pixel normals(almost nothing in google about that) or any other way to make it smooth?

##### Share on other sites

Hello

f0 to f5 must be normalized before averaging them to get v0Normal.

Even if the points are aligned on x and z axes, the triangles have generally differents areas, so the norms of f0 to f5 are generally not the same.

( according to the cross product properties, the norm of f0 is 2x the area of the triangle (v0,v1,v2) )

f0=normalize(crossProduct(v1-v0,v2-v0))
.
.
.

v0Normal=(f0+f1+f2+f3+f4+f5)/6

should work better

I noticed a confusion between your formulas and your scheme, for example according to your scheme f0 should be the normal of the triangle (v0,v1,v6), not (v0,v1,v2). Hoping this is just wrong typo ?

Edited by Tournicoti