• 9
• 10
• 11
• 13
• 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!

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

## Recommended Posts

Hey guys,

I'm trying to implement CSM in my engine (using this tutorial: http://www.ogldev.org/www/tutorial49/tutorial49.html) but i'm having trouble with the frustums direction (which is the sun).

The problem is that in the first frame the shadows are correctly working but as soon as i rotate the viewers camera, each camera rotates to the opposite side of what it should. For example if i look to the left, each frustum rotates to the right (from the viewers perspective) which causes the depth map to be looking at the wrong spot.

The code that i have to calculate the MVP matrix for each cascaded camera is:

void deferredRenderer::calcOrthoProjections(openGLCamera::Camera lightCamera, openGLCamera::Camera camera)
{

float lambda = 0.5;    // Lambda value for split distance calc. (based on GPU gems paralel splits by nvidia)
float n = camera.getNearClip();
float f = camera.getFarClip();

glm::mat4 invCameraView = glm::inverse(camera.View);

// Get the light view transform (lookat is always (0,0-1)
glm::mat4 lightView = glm::lookAt(glm::vec3(0), lightCamera.getCameraLookAt(),  glm::vec3(0,1,0));

float ar = 1.0f/camera.GetAspectRatio();

float tanHalfHFOV = tanf(glm::radians((camera.GetFOV()) / 2.0f));
float tanHalfVFOV = tanf(glm::radians((camera.GetFOV() * ar) / 2.0f));

// Projection information

for (uint i = 0 ; i < nShadowMaps ; i++)
{

// Calculate the split distance (based on GPU gems parallel splits by novidia)
float cuni = n + ((f-n)*((i+1)/(float)nShadowMaps));
float clog = n * std::powf(f/n, (i+1)/(float)nShadowMaps);
float c = lambda*cuni + (1-lambda)*clog;

float xn = m_cascadeEnd[i] * tanHalfHFOV;
float xf = m_cascadeEnd[i + 1] * tanHalfHFOV;
float yn = m_cascadeEnd[i] * tanHalfVFOV;
float yf = m_cascadeEnd[i + 1] * tanHalfVFOV;

// These corners are view space vectors
glm::vec4 frustumCorners[8] =
{
// near face

// far face
glm::vec4(xf, yf, m_cascadeEnd[i + 1], 1.0),
glm::vec4(-xf, yf, m_cascadeEnd[i + 1], 1.0),
glm::vec4(xf, -yf, m_cascadeEnd[i + 1], 1.0),
glm::vec4(-xf, -yf, m_cascadeEnd[i + 1], 1.0)
};

glm::vec4 frustumCornersL[8];

float minX = std::numeric_limits<float>::max();
float maxX = std::numeric_limits<float>::min();
float minY = std::numeric_limits<float>::max();
float maxY = std::numeric_limits<float>::min();
float minZ = std::numeric_limits<float>::max();
float maxZ = std::numeric_limits<float>::min();

// Rotate the camera so its facing from up -> down
glm::mat4 modelMatrix = glm::rotate(glm::mat4(1), 3.1415f/3.0f, glm::vec3(1,0,0));

for (uint j = 0 ; j < 8 ; j++)
{
// Transform the frustum coordinate from view to world space
glm::vec4 vW = invCameraView * frustumCorners[j];

// Transform the frustum coordinate from world to light space
frustumCornersL[j] = lightView * vW;

minX = std::min(minX, frustumCornersL[j].x);
maxX = std::max(maxX, frustumCornersL[j].x);
minY = std::min(minY, frustumCornersL[j].y);
maxY = std::max(maxY, frustumCornersL[j].y);
minZ = std::min(minZ, frustumCornersL[j].z);
maxZ = std::max(maxZ, frustumCornersL[j].z);
}

lightProjView[i] = Projection * lightView * modelMatrix;

}
}


Any information that you need i will gladly provide. Thank you in advance.

Edited by André