Shader fixes
This commit is contained in:
parent
3993017ea6
commit
1815168479
Binary file not shown.
@ -227,7 +227,7 @@ namespace FirstPlugin
|
||||
invertedCamera = mvpMat.Inverted();
|
||||
|
||||
Vector3 lightDirection = new Vector3(0f, 0f, -1f);
|
||||
Vector3 difLightDirection = Vector3.TransformNormal(lightDirection, invertedCamera).Normalized();
|
||||
Vector3 difLightDirection = Vector3.TransformNormal(lightDirection, invertedCamera).Normalized();
|
||||
|
||||
GL.Enable(EnableCap.Texture2D);
|
||||
GL.Enable(EnableCap.DepthTest);
|
||||
@ -359,14 +359,19 @@ namespace FirstPlugin
|
||||
|
||||
Matrix4 sphereMatrix = mvpMat;
|
||||
|
||||
if (sphereMatrix.Determinant != 0)
|
||||
sphereMatrix.Invert();
|
||||
Matrix4 invertedCamera = Matrix4.Identity;
|
||||
// invertedCamera = mvpMat.Inverted();
|
||||
// if (invertedCamera.Determinant == 0)
|
||||
// invertedCamera = Matrix4.Identity;
|
||||
|
||||
sphereMatrix = invertedCamera;
|
||||
sphereMatrix.Transpose();
|
||||
|
||||
shader.SetMatrix4x4("sphereMatrix", ref sphereMatrix);
|
||||
|
||||
shader.SetMatrix4x4("mtxCam", ref computedCamMtx);
|
||||
shader.SetMatrix4x4("mtxMdl", ref mdlMat);
|
||||
shader.SetVector3("cameraPosition", control.CameraPosition);
|
||||
|
||||
SetRenderSettings(shader);
|
||||
|
||||
@ -375,17 +380,9 @@ namespace FirstPlugin
|
||||
shader.SetVector3("difLightColor", new Vector3(1));
|
||||
shader.SetVector3("ambLightColor", new Vector3(1));
|
||||
|
||||
Matrix4 invertedCamera = Matrix4.Identity;
|
||||
if (invertedCamera.Determinant != 0)
|
||||
invertedCamera = mvpMat.Inverted();
|
||||
|
||||
Vector3 lightDirection = new Vector3(0f, 0f, -1f);
|
||||
|
||||
//Todo. Maybe change direction via AAMP file (configs shader data)
|
||||
shader.SetVector3("specLightDirection", Vector3.TransformNormal(lightDirection, invertedCamera).Normalized());
|
||||
shader.SetVector3("difLightDirection", Vector3.TransformNormal(lightDirection, invertedCamera).Normalized());
|
||||
|
||||
|
||||
GL.Enable(EnableCap.AlphaTest);
|
||||
GL.AlphaFunc(AlphaFunction.Gequal, 0.1f);
|
||||
|
||||
|
@ -14,6 +14,8 @@ namespace FirstPlugin.Forms
|
||||
{
|
||||
public partial class Color8KeySlider : STPanel, IColorPanelCommon
|
||||
{
|
||||
public bool IsAlpha { get; set; }
|
||||
|
||||
private int SelectedIndex = 0;
|
||||
public Color GetColor()
|
||||
{
|
||||
|
@ -13,6 +13,8 @@ namespace FirstPlugin.Forms
|
||||
{
|
||||
public partial class ColorConstantPanel : UserControl, IColorPanelCommon
|
||||
{
|
||||
public bool IsAlpha { get; set; }
|
||||
|
||||
public ColorConstantPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -13,6 +13,8 @@ namespace FirstPlugin.Forms
|
||||
{
|
||||
public partial class ColorRandomPanel : UserControl, IColorPanelCommon
|
||||
{
|
||||
public bool IsAlpha { get; set; }
|
||||
|
||||
public ColorRandomPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -90,7 +90,7 @@
|
||||
this.stTabControl1.myBackColor = System.Drawing.Color.Empty;
|
||||
this.stTabControl1.Name = "stTabControl1";
|
||||
this.stTabControl1.SelectedIndex = 0;
|
||||
this.stTabControl1.Size = new System.Drawing.Size(555, 561);
|
||||
this.stTabControl1.Size = new System.Drawing.Size(576, 561);
|
||||
this.stTabControl1.TabIndex = 38;
|
||||
//
|
||||
// tabPageData
|
||||
@ -99,7 +99,7 @@
|
||||
this.tabPageData.Location = new System.Drawing.Point(4, 25);
|
||||
this.tabPageData.Name = "tabPageData";
|
||||
this.tabPageData.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPageData.Size = new System.Drawing.Size(547, 532);
|
||||
this.tabPageData.Size = new System.Drawing.Size(568, 532);
|
||||
this.tabPageData.TabIndex = 0;
|
||||
this.tabPageData.Text = "Emitter Data";
|
||||
this.tabPageData.UseVisualStyleBackColor = true;
|
||||
@ -127,7 +127,7 @@
|
||||
this.stPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.stPanel2.Location = new System.Drawing.Point(3, 3);
|
||||
this.stPanel2.Name = "stPanel2";
|
||||
this.stPanel2.Size = new System.Drawing.Size(541, 526);
|
||||
this.stPanel2.Size = new System.Drawing.Size(562, 526);
|
||||
this.stPanel2.TabIndex = 0;
|
||||
//
|
||||
// emitterTexturePanel1
|
||||
@ -144,6 +144,7 @@
|
||||
this.pictureBox4.Size = new System.Drawing.Size(40, 40);
|
||||
this.pictureBox4.TabIndex = 45;
|
||||
this.pictureBox4.TabStop = false;
|
||||
this.pictureBox4.Click += new System.EventHandler(this.pictureBox4_Click);
|
||||
//
|
||||
// timeTB
|
||||
//
|
||||
@ -155,12 +156,13 @@
|
||||
//
|
||||
// colorSelector1
|
||||
//
|
||||
this.colorSelector1.Alpha = 0;
|
||||
this.colorSelector1.Color = System.Drawing.Color.Empty;
|
||||
this.colorSelector1.DisplayAlpha = true;
|
||||
this.colorSelector1.DisplayColor = true;
|
||||
this.colorSelector1.Location = new System.Drawing.Point(316, 44);
|
||||
this.colorSelector1.MaximumSize = new System.Drawing.Size(212, 188);
|
||||
this.colorSelector1.MinimumSize = new System.Drawing.Size(212, 188);
|
||||
this.colorSelector1.Name = "colorSelector1";
|
||||
this.colorSelector1.Size = new System.Drawing.Size(212, 188);
|
||||
this.colorSelector1.Size = new System.Drawing.Size(233, 188);
|
||||
this.colorSelector1.TabIndex = 44;
|
||||
this.colorSelector1.ColorChanged += new System.EventHandler(this.colorSelector1_ColorChanged);
|
||||
//
|
||||
@ -273,7 +275,7 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.stTabControl1);
|
||||
this.Name = "EmitterEditorNX";
|
||||
this.Size = new System.Drawing.Size(555, 561);
|
||||
this.Size = new System.Drawing.Size(576, 561);
|
||||
this.stTabControl1.ResumeLayout(false);
|
||||
this.tabPageData.ResumeLayout(false);
|
||||
this.stPanel2.ResumeLayout(false);
|
||||
|
@ -60,6 +60,7 @@ namespace FirstPlugin
|
||||
colorSlider.Dock = DockStyle.Fill;
|
||||
colorSlider.ColorSelected += ColorPanelSelected;
|
||||
panel.Controls.Add(colorSlider);
|
||||
colorSlider.IsAlpha = (type == 2 || type == 3);
|
||||
|
||||
if (type == 0)
|
||||
colorSlider.LoadColors(colors, (int)ActiveEmitter.Color0KeyCount);
|
||||
@ -75,6 +76,7 @@ namespace FirstPlugin
|
||||
ColorRandomPanel colorRandomPnl = new ColorRandomPanel();
|
||||
colorRandomPnl.ColorSelected += ColorPanelSelected;
|
||||
panel.Controls.Add(colorRandomPnl);
|
||||
colorRandomPnl.IsAlpha = (type == 2 || type == 3);
|
||||
|
||||
colorRandomPnl.LoadColors(colors);
|
||||
}
|
||||
@ -83,6 +85,7 @@ namespace FirstPlugin
|
||||
ColorConstantPanel colorConstantPnl = new ColorConstantPanel();
|
||||
colorConstantPnl.ColorSelected += ColorPanelSelected;
|
||||
panel.Controls.Add(colorConstantPnl);
|
||||
colorConstantPnl.IsAlpha = (type == 2 || type == 3);
|
||||
|
||||
if (type == 0)
|
||||
colorConstantPnl.LoadColor(ActiveEmitter.ConstantColor0);
|
||||
@ -103,7 +106,20 @@ namespace FirstPlugin
|
||||
hexTB.Text = "";
|
||||
|
||||
ActivePanel = panel;
|
||||
if (ActivePanel.IsAlpha)
|
||||
{
|
||||
colorSelector1.DisplayColor = false;
|
||||
colorSelector1.DisplayAlpha = true;
|
||||
colorSelector1.Alpha = panel.GetColor().R;
|
||||
}
|
||||
else
|
||||
{
|
||||
colorSelector1.DisplayColor = true;
|
||||
colorSelector1.DisplayAlpha = false;
|
||||
}
|
||||
|
||||
UpdateColorSelector(panel.GetColor());
|
||||
|
||||
if (panel is Color8KeySlider)
|
||||
UpdateTimeDisplay(((Color8KeySlider)panel).GetTime());
|
||||
}
|
||||
@ -243,5 +259,10 @@ namespace FirstPlugin
|
||||
if (_UpdateSelector)
|
||||
colorSelector1.Color = color;
|
||||
}
|
||||
|
||||
private void pictureBox4_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,5 +14,6 @@ namespace FirstPlugin.Forms
|
||||
event EventHandler ColorSelected;
|
||||
void SelectPanel();
|
||||
void DeselectPanel();
|
||||
bool IsAlpha { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -28,16 +28,58 @@ namespace Toolbox.Library.Forms
|
||||
/// </summary>
|
||||
public Color Color
|
||||
{
|
||||
get { return _color; }
|
||||
get
|
||||
{
|
||||
if (DisplayColor)
|
||||
return _color;
|
||||
else
|
||||
return Color.FromArgb(Alpha, Alpha, Alpha);
|
||||
}
|
||||
set
|
||||
{
|
||||
_color = value;
|
||||
OnColorChanged(false);
|
||||
}
|
||||
}
|
||||
|
||||
private int _alpha;
|
||||
public int Alpha
|
||||
{
|
||||
get { return _alpha; }
|
||||
set
|
||||
{
|
||||
_alpha = value;
|
||||
alphaPanel.Invalidate();
|
||||
OnColorChanged(false);
|
||||
}
|
||||
}
|
||||
|
||||
private bool displayAlpha = true;
|
||||
public bool DisplayAlpha
|
||||
{
|
||||
get { return displayAlpha; }
|
||||
set
|
||||
{
|
||||
displayAlpha = value;
|
||||
alphaPanel.Enabled = displayAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
private bool displayColor = true;
|
||||
public bool DisplayColor
|
||||
{
|
||||
get { return displayColor; }
|
||||
set
|
||||
{
|
||||
displayColor = value;
|
||||
huePanel.Enabled = displayColor;
|
||||
}
|
||||
}
|
||||
|
||||
private LinearGradientBrush _hueBrush;
|
||||
private STPanel colorSquare;
|
||||
private STPanel huePanel;
|
||||
private STPanel alphaPanel;
|
||||
private PathGradientBrush _mainBrush;
|
||||
|
||||
public ColorSelector()
|
||||
@ -52,6 +94,7 @@ namespace Toolbox.Library.Forms
|
||||
|
||||
colorSquare.SetDoubleBuffer();
|
||||
huePanel.SetDoubleBuffer();
|
||||
alphaPanel.SetDoubleBuffer();
|
||||
}
|
||||
|
||||
private Point CursorPoint = new Point(0,0);
|
||||
@ -62,6 +105,7 @@ namespace Toolbox.Library.Forms
|
||||
{
|
||||
this.colorSquare = new Toolbox.Library.Forms.STPanel();
|
||||
this.huePanel = new Toolbox.Library.Forms.STPanel();
|
||||
this.alphaPanel = new Toolbox.Library.Forms.STPanel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// colorSquare
|
||||
@ -90,14 +134,26 @@ namespace Toolbox.Library.Forms
|
||||
this.huePanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.huePanel_MouseMove);
|
||||
this.huePanel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.huePanel_MouseUp);
|
||||
//
|
||||
// alphaPanel
|
||||
//
|
||||
this.alphaPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.alphaPanel.Location = new System.Drawing.Point(208, 3);
|
||||
this.alphaPanel.Name = "alphaPanel";
|
||||
this.alphaPanel.Size = new System.Drawing.Size(16, 180);
|
||||
this.alphaPanel.TabIndex = 2;
|
||||
this.alphaPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.alphaPanel_Paint);
|
||||
this.alphaPanel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.alphaPanel_MouseDown);
|
||||
this.alphaPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.alphaPanel_MouseMove);
|
||||
this.alphaPanel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.alphaPanel_MouseUp);
|
||||
//
|
||||
// ColorSelector
|
||||
//
|
||||
this.Controls.Add(this.alphaPanel);
|
||||
this.Controls.Add(this.huePanel);
|
||||
this.Controls.Add(this.colorSquare);
|
||||
this.MaximumSize = new System.Drawing.Size(212, 188);
|
||||
this.MinimumSize = new System.Drawing.Size(212, 188);
|
||||
this.Name = "ColorSelector";
|
||||
this.Size = new System.Drawing.Size(212, 188);
|
||||
this.Size = new System.Drawing.Size(227, 188);
|
||||
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ColorSelector_MouseMove);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
@ -151,12 +207,12 @@ namespace Toolbox.Library.Forms
|
||||
|
||||
Rectangle r = colorSquare.ClientRectangle;
|
||||
|
||||
//Split the hue colors
|
||||
float p = r.Height / numHueColors / r.Height;
|
||||
|
||||
//Draw the hue slider
|
||||
var g = e.Graphics;
|
||||
|
||||
//Split the hue colors
|
||||
float p = r.Height / numHueColors / r.Height;
|
||||
|
||||
_hueBrush = new LinearGradientBrush(new Rectangle(0, 0, r.Width, r.Height), Color.Red, Color.Red, LinearGradientMode.Vertical);
|
||||
|
||||
//Create the hue list
|
||||
@ -172,9 +228,17 @@ namespace Toolbox.Library.Forms
|
||||
Color.Red
|
||||
};
|
||||
|
||||
if (!huePanel.Enabled)
|
||||
{
|
||||
for (int i = 0; i < blend.Colors.Length; i++)
|
||||
blend.Colors[i] = blend.Colors[i].Darken(190);
|
||||
}
|
||||
|
||||
blend.Positions = new float[] { 0, p, p * 2, p * 3, p * 4, p * 5, 1.0f };
|
||||
_hueBrush.InterpolationColors = blend;
|
||||
|
||||
|
||||
|
||||
g.FillRectangle(_hueBrush, r);
|
||||
|
||||
Color pixel = new HSVPixel(_hsv.H, 100, 100).ToRGBA().Inverse();
|
||||
@ -214,7 +278,13 @@ namespace Toolbox.Library.Forms
|
||||
_mainBrush.SurroundColors = _boxColors;
|
||||
_mainBrush.CenterColor = new HSVPixel(_hsv.H, 50, 50).ToRGBA();
|
||||
_mainBrush.CenterPoint = new PointF(r.Width / 2, r.Height / 2);
|
||||
|
||||
|
||||
if (!huePanel.Enabled)
|
||||
{
|
||||
for (int i = 0; i < _mainBrush.SurroundColors.Length; i++)
|
||||
_mainBrush.SurroundColors[i] = _mainBrush.SurroundColors[i].Darken(190);
|
||||
}
|
||||
|
||||
g.FillRectangle(_mainBrush, r);
|
||||
|
||||
|
||||
@ -272,12 +342,82 @@ namespace Toolbox.Library.Forms
|
||||
_squareSelected = false;
|
||||
}
|
||||
|
||||
private bool _alphaBarSelected = false;
|
||||
private int alphaY;
|
||||
|
||||
private void alphaPanel_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
_alphaBarSelected = true;
|
||||
alphaPanel_MouseMove(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void alphaPanel_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
_alphaBarSelected = false;
|
||||
}
|
||||
|
||||
private void alphaPanel_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (_alphaBarSelected)
|
||||
{
|
||||
int y = Math.Max(Math.Min(e.Y, (alphaPanel.Height - 1)), 0);
|
||||
if (y != alphaY)
|
||||
{
|
||||
alphaY = y;
|
||||
Alpha = (byte)(255 - ((float)y / (alphaPanel.Height - 1) * 255));
|
||||
|
||||
if (ColorChanged != null)
|
||||
ColorChanged(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void alphaPanel_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
var alphaBrush = new LinearGradientBrush(new Rectangle(0, 0, alphaPanel.Width, alphaPanel.Height), Color.White, Color.Black, LinearGradientMode.Vertical);
|
||||
|
||||
Graphics g = e.Graphics;
|
||||
|
||||
if (!alphaPanel.Enabled)
|
||||
{
|
||||
for (int i = 0; i < alphaBrush.LinearColors.Length; i++)
|
||||
alphaBrush.LinearColors[i] = alphaBrush.LinearColors[i].Darken(190);
|
||||
}
|
||||
|
||||
//Draw bar
|
||||
g.FillRectangle(alphaBrush, alphaPanel.ClientRectangle);
|
||||
|
||||
//Draw indicator
|
||||
byte col = (byte)(255 - Alpha);
|
||||
Color p = Color.FromArgb(255, col, col, col);
|
||||
int y = (int)(col / 255.0f * (alphaPanel.Height - 1));
|
||||
Rectangle r = new Rectangle(-1, y - 2, alphaPanel.Width + 1, 4);
|
||||
|
||||
using (Pen pen = new Pen(p))
|
||||
g.DrawRectangle(pen, r);
|
||||
|
||||
p.Lighten(64);
|
||||
|
||||
r.Y += 1;
|
||||
r.Height -= 2;
|
||||
|
||||
using (Pen pen = new Pen(p))
|
||||
g.DrawRectangle(pen, r);
|
||||
}
|
||||
|
||||
private void colorSquare_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (_squareSelected)
|
||||
{
|
||||
int x = Math.Min(Math.Max(e.X, 0), colorSquare.Width);
|
||||
int y = Math.Min(Math.Max(e.Y, 0), colorSquare.Height);
|
||||
if (!DisplayColor)
|
||||
y = colorSquare.Height;
|
||||
|
||||
if ((x != _squareX) || (y != _squareY))
|
||||
{
|
||||
_hsv.V = (byte)((float)x / colorSquare.Width * 100);
|
||||
|
@ -23,5 +23,10 @@ namespace Toolbox.Library.IO
|
||||
{
|
||||
return Color.FromArgb(color.A, (byte)Math.Min(color.R + amount, 255), (byte)Math.Min(color.G + amount, 255), (byte)Math.Min(color.B + amount, 255));
|
||||
}
|
||||
|
||||
public static Color Darken(this Color color, int amount)
|
||||
{
|
||||
return Color.FromArgb(color.A, (byte)Math.Max(color.R - amount, 0), (byte)Math.Max(color.G - amount, 0), (byte)Math.Max(color.B - amount, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
@ -32,10 +32,11 @@ uniform sampler2D SphereMap;
|
||||
uniform sampler2D SubSurfaceScatteringMap;
|
||||
|
||||
// Viewport Camera/Lighting
|
||||
uniform vec3 difLightDirection;
|
||||
uniform mat4 mtxCam;
|
||||
uniform mat4 mtxMdl;
|
||||
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
// Viewport Settings
|
||||
uniform int uvChannel;
|
||||
uniform int renderType;
|
||||
@ -173,9 +174,6 @@ void main()
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate shading vectors.
|
||||
vec3 I = vec3(0,0,-1) * mat3(mtxCam);
|
||||
|
||||
int NormalMapUVIndex = 0;
|
||||
|
||||
if (uking_texture2_texcoord == 1 || cIsEnableNormalMap == 1)
|
||||
@ -185,14 +183,18 @@ void main()
|
||||
if (HasNormalMap == 1 && useNormalMap == 1)
|
||||
N = CalcBumpedNormal(normal, NormalMap, vert, NormalMapUVIndex);
|
||||
|
||||
// Calculate shading vectors.
|
||||
vec3 I = vec3(0,0,-1) * mat3(mtxCam);
|
||||
vec3 V = normalize(I); // view
|
||||
vec3 R = reflect(-I, N); // reflection
|
||||
|
||||
float light = max(dot(N, V), 0.0);
|
||||
|
||||
// Light Map
|
||||
vec4 LightMapColor = texture(BakeLightMap, f_texcoord2);
|
||||
|
||||
BakedData ShadowBake = ShadowMapBaked(BakeShadowMap,BakeLightMap, f_texcoord1, f_texcoord2, int(bake_shadow_type),int(bake_light_type), int(bake_calc_type), N );
|
||||
|
||||
// Diffuse lighting.
|
||||
float halfLambert = dot(difLightDirection, N) * 0.5 + 0.5;
|
||||
|
||||
vec4 diffuseMapColor = vec4(texture(DiffuseMap, f_texcoord0).rgba);
|
||||
vec4 albedo = vec4(0);
|
||||
//Comp Selectors
|
||||
@ -218,7 +220,7 @@ void main()
|
||||
alpha *= 0.5;
|
||||
}
|
||||
|
||||
albedo *= halfLambert;
|
||||
albedo *= light;
|
||||
|
||||
vec3 LightingDiffuse = vec3(0);
|
||||
if (HasLightMap == 1)
|
||||
|
@ -19,8 +19,6 @@ in vec3 boneWeightsColored;
|
||||
uniform mat4 mtxMdl;
|
||||
uniform mat4 mtxCam;
|
||||
|
||||
uniform vec3 specLightDirection;
|
||||
uniform vec3 difLightDirection;
|
||||
uniform mat4 projMatrix;
|
||||
uniform mat4 normalMatrix;
|
||||
uniform mat4 modelViewMatrix;
|
||||
@ -230,8 +228,10 @@ void main()
|
||||
}
|
||||
else if (renderType == 2) // Lighting
|
||||
{
|
||||
float halfLambert = dot(difLightDirection, N) * 0.5 + 0.5;
|
||||
fragColor = vec4(vec3(halfLambert), 1);
|
||||
vec3 I = vec3(0,0,-1) * mat3(mtxCam);
|
||||
vec3 V = normalize(I); // view
|
||||
float light = max(dot(N, V), 0.0);
|
||||
fragColor = vec4(vec3(light), 1);
|
||||
}
|
||||
else if (renderType == 4) //Display Normal
|
||||
{
|
||||
|
@ -18,8 +18,6 @@ in vec3 boneWeightsColored;
|
||||
uniform mat4 mtxCam;
|
||||
uniform mat4 mtxMdl;
|
||||
|
||||
uniform vec3 specLightDirection;
|
||||
uniform vec3 difLightDirection;
|
||||
uniform mat4 projMatrix;
|
||||
uniform mat4 normalMatrix;
|
||||
uniform mat4 modelViewMatrix;
|
||||
@ -308,8 +306,8 @@ void main()
|
||||
N = CalcBumpedNormal(normal, NormalMap, vert, 0);
|
||||
|
||||
vec3 V = normalize(I); // view
|
||||
vec3 L = normalize(specLightDirection); // Light
|
||||
vec3 H = normalize(specLightDirection + I); // half angle
|
||||
vec3 L = normalize(objectPosition - I); // Light
|
||||
vec3 H = normalize(objectPosition + I); // half angle
|
||||
vec3 R = reflect(-I, N); // reflection
|
||||
|
||||
vec3 f0 = mix(vec3(0.04), albedo, metallic); // dialectric
|
||||
|
Loading…
Reference in New Issue
Block a user