Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am trying to create a texture of elliptical dots but it isn't#version 3 3 0 compatibility out vec 4 FragColor; / / lighting uniform
I am trying to create a texture of elliptical dots but it isn't#version compatibility out vec FragColor; lighting uniform variables these can be set once and left alone: uniform float uKa, uKd, uKs; coefficients of each type of lighting make sum to uniform vec uColor; object color uniform vec uSpecularColor; light color uniform float uShininess; specular exponent ellipse parameters: uniform float uAd, uBd, uTol; in variables from the vertex shader and interpolated in the rasterizer: in vec vN; normal vector in vec vL; vector from point to light in vec vE; vector from point to eye in vec vST; st texture coordinates void main float s vSTs; float t vSTt; determine the color using the ellipse equation: float ellipseResult pows uAd powuAdpowt uBd powuBd; float blendFactor smoothstep uTol, uTol, ellipseResult; vec myColor mixuColorrgb vec blendFactor; lilac apply the perfragment lighting to myColor: vec Normal normalizevN; vec Light normalizevL; vec Eye normalizevE; vec ambient uKa myColor; float dd maxdotNormal Light; only do diffuse if the light can see the point vec diffuse uKd dd myColor; float ss ; if dotNormal Light only do specular if the light can see the point vec ref normalizereflectLight, Normal; ss powmaxdotEye ref uShininess; vec specular uKs ss uSpecularColor.rgb; FragColor vecmyColor; working. what should it look like?
I am trying to create a texture of elliptical dots but it isn't#version compatibility
out vec FragColor;
lighting uniform variables these can be set once and left alone:
uniform float uKa, uKd, uKs; coefficients of each type of lighting make sum to
uniform vec uColor; object color
uniform vec uSpecularColor; light color
uniform float uShininess; specular exponent
ellipse parameters:
uniform float uAd, uBd, uTol;
in variables from the vertex shader and interpolated in the rasterizer:
in vec vN; normal vector
in vec vL; vector from point to light
in vec vE; vector from point to eye
in vec vST; st texture coordinates
void main
float s vSTs;
float t vSTt;
determine the color using the ellipse equation:
float ellipseResult pows uAd powuAdpowt uBd powuBd;
float blendFactor smoothstep uTol, uTol, ellipseResult;
vec myColor mixuColorrgb vec blendFactor; lilac
apply the perfragment lighting to myColor:
vec Normal normalizevN;
vec Light normalizevL;
vec Eye normalizevE;
vec ambient uKa myColor;
float dd maxdotNormal Light; only do diffuse if the light can see the point
vec diffuse uKd dd myColor;
float ss ;
if dotNormal Light only do specular if the light can see the point
vec ref normalizereflectLight, Normal;
ss powmaxdotEye ref uShininess;
vec specular uKs ss uSpecularColor.rgb;
FragColor vecmyColor;
working. what should it look like?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started