[Blender] shadow mapping SORRY
matechbau at gmail.com
matechbau at gmail.com
Thu Jun 18 17:28:36 CEST 2015
Hatte die Mail noch nicht genauer angesehen.
Sorry!
Nichts passiert, bei mir.
mfg
Dieter
> Am 18.06.2015 um 17:06 schrieb Nikolaus Leopold <nikolaus.leopold at gmail.com>:
>
> Bitte vielmals um entschuldigung!!!!! Diese Mail ging an den falschen Empfänger! :/
>
> mfG
> Nikolaus
>
>> On 2015-06-18 11:54, Nikolaus Leopold wrote:
>> vlt ist da was hilfreicehes dabei aber ich weiß nicht
>>
>> //// depths from light position for shading mapping
>>
>> // set viewport and bind framebuffer
>> glViewport(0, 0, SM_WIDTH, SM_HEIGHT);
>> glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);
>> glClear(GL_DEPTH_BUFFER_BIT);
>>
>> // calculate lights projection and view Matrix
>> GLfloat nearPlane = 50.f, farPlane = 400.f;
>> glm::mat4 lightProjection = glm::ortho(-100.0f, 100.0f, -100.0f, 100.0f, nearPlane, farPlane);
>> //glm::mat4 lightProjection = glm::perspective(100.f, (GLfloat) SM_WIDTH / (GLfloat) SM_HEIGHT, nearPlane, farPlane);
>> glm::mat4 lightView = glm::lookAt(sun->getLocation(), glm::vec3(0.f), glm::vec3(0, 1, 0));
>> glm::mat4 lightVP = lightProjection * lightView;
>>
>> // prepare shader
>> Shader *lastShader = activeShader;
>> setActiveShader(depthMapShader);
>> GLint lightVPLocation = glGetUniformLocation(activeShader->programHandle, "lightVP");
>> glUniformMatrix4fv(lightVPLocation, 1, GL_FALSE, glm::value_ptr(lightVP));
>>
>> // render
>>
>> drawScene();
>>
>> // bind default FB and reset viewport
>> glBindFramebuffer(GL_FRAMEBUFFER, 0);
>> glViewport(0, 0, windowWidth, windowHeigth);
>>
>> setActiveShader(textureShader);
>>
>> glUniformMatrix4fv(glGetUniformLocation(activeShader->programHandle, "viewMat"), 1, GL_FALSE, glm::value_ptr(player->getViewMat()));
>> glUniformMatrix4fv(glGetUniformLocation(activeShader->programHandle, "lightVP"), 1, GL_FALSE, glm::value_ptr(lightVP));
>>
>> GLint shadowMapLocation = glGetUniformLocation(activeShader->programHandle, "shadowMap");
>> glUniform1i(shadowMapLocation, 1);
>> glActiveTexture(GL_TEXTURE0 + 1);
>> glBindTexture(GL_TEXTURE_2D, depthMap);
>
>
> _______________________________________________
> Blender mailing list
> Blender at lists.metalab.at
> https://lists.metalab.at/mailman/listinfo/blender
More information about the Blender
mailing list