OpenGL["noël"]

OpenGL["noël"]

  • Intro et SDK
  • Bronze
  • Silver
  • Gold
  • Blog
  • OpenGL Documentation
  • OpenGL Wiki
  • GitHub
  • My glTF Viewer Tutorial

›Forward Renderer

Introduction et SDK

  • Introduction
  • Fiche d'information
  • Projet - Un viewer glTF

Forward Renderer

  • Pipeline de Rendu
  • Geometrie
  • Shaders
  • Transformations
  • Lighting
  • Textures
  • Chargement de modèles OBJ
  • Aller plus loin

Deferred Renderer

  • Pipeline de Rendu
  • Geometrie Pass
  • Shading Pass
  • Aller plus loin

Shadow Mapping

  • Introduction
  • Directional Shadow Map
  • Percentage Closest Filtering
  • Aller Plus Loin

Post Processing

  • Introduction
  • Gamma Correction
  • Extraction et Rendu de Contours
  • Depth of Field

Annexe: API OpenGL

  • Contexte OpenGL
  • Pipeline de Rendu
  • Extensions OpenGL
  • Objets OpenGL
  • Buffer Objects
  • Vertex Array Objects
  • Texture Objects
  • Framebuffer Objects
  • Shaders

Lighting

Fragment Shader

Implémenter un modèle d'illumination diffuse dans le fragment shader forward.fs.glsl

  • Ajouter des variables uniform vec3 uDirectionalLightDir et vec3 uDirectionalLightIntensity destinées à stocker les paramètres d'une lumière directionnelle (en espace view)
  • Ajouter des variables uniform vec3 uPointLightPosition et vec3 uPointLightIntensity destinées à stocker les paramètres d'une lumière ponctuelle (en espace view)
  • Ajouter une variable uniform vec3 uKd destinée à stocker la couleur diffuse de l'objet en cours de rendu
  • Dans le main, utiliser ces variables ainsi que les attributs du fragment pour calculer la couleur du fragment:
float distToPointLight = length(uPointLightPosition - vViewSpacePosition);
vec3 dirToPointLight = (uPointLightPosition - vViewSpacePosition) / distToPointLight;
fColor = uKd * (uDirectionalLightIntensity * max(0.0, dot(vViewSpaceNormal, uDirectionalLightDir)) + uPointLightIntensity * max(0.0, dot(vViewSpaceNormal, dirToPointLight)) / (distToPointLight * distToPointLight))

Application

A l'initialisation:

  • Récupérer les locations des nouvelles uniform

Au rendu:

  • Envoyer les différentes uniformes avant le rendu de chaque objet (les lights doivent être partagé)
  • Faire en sorte de pouvoir régler les paramètres des lights et la couleur diffuse des objets depuis la GUI

Fonctions GL à utiliser:

  • glUniform3f
← TransformationsTextures →
  • Fragment Shader
  • Application
OpenGL["noël"]
About Me
Personal websiteGithub
About This Website
BlogopenglnoelPowered by Docusaurus
About OpenGL
Documentation (docs.gl)Wiki
Copyright © 2021 Laurent NOEL