Merge pull request #44614 from madmiraal/rename-normalmap-normal_map
Consistently use normal_map
This commit is contained in:
commit
2086acfacc
|
@ -1753,10 +1753,10 @@ Error Image::generate_mipmaps(bool p_renormalize) {
|
|||
|
||||
Error Image::generate_mipmap_roughness(RoughnessChannel p_roughness_channel, const Ref<Image> &p_normal_map) {
|
||||
Vector<double> normal_sat_vec; //summed area table
|
||||
double *normal_sat = nullptr; //summed area table for normalmap
|
||||
double *normal_sat = nullptr; //summed area table for normal map
|
||||
int normal_w = 0, normal_h = 0;
|
||||
|
||||
ERR_FAIL_COND_V_MSG(p_normal_map.is_null() || p_normal_map->is_empty(), ERR_INVALID_PARAMETER, "Must provide a valid normalmap for roughness mipmaps");
|
||||
ERR_FAIL_COND_V_MSG(p_normal_map.is_null() || p_normal_map->is_empty(), ERR_INVALID_PARAMETER, "Must provide a valid normal map for roughness mipmaps");
|
||||
|
||||
Ref<Image> nm = p_normal_map->duplicate();
|
||||
if (nm->is_compressed()) {
|
||||
|
@ -3109,9 +3109,9 @@ void Image::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("fix_alpha_edges"), &Image::fix_alpha_edges);
|
||||
ClassDB::bind_method(D_METHOD("premultiply_alpha"), &Image::premultiply_alpha);
|
||||
ClassDB::bind_method(D_METHOD("srgb_to_linear"), &Image::srgb_to_linear);
|
||||
ClassDB::bind_method(D_METHOD("normalmap_to_xy"), &Image::normalmap_to_xy);
|
||||
ClassDB::bind_method(D_METHOD("normal_map_to_xy"), &Image::normal_map_to_xy);
|
||||
ClassDB::bind_method(D_METHOD("rgbe_to_srgb"), &Image::rgbe_to_srgb);
|
||||
ClassDB::bind_method(D_METHOD("bumpmap_to_normalmap", "bump_scale"), &Image::bumpmap_to_normalmap, DEFVAL(1.0));
|
||||
ClassDB::bind_method(D_METHOD("bump_map_to_normal_map", "bump_scale"), &Image::bump_map_to_normal_map, DEFVAL(1.0));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("blit_rect", "src", "src_rect", "dst"), &Image::blit_rect);
|
||||
ClassDB::bind_method(D_METHOD("blit_rect_mask", "src", "mask", "src_rect", "dst"), &Image::blit_rect_mask);
|
||||
|
@ -3220,7 +3220,7 @@ void Image::set_compress_bptc_func(void (*p_compress_func)(Image *, float, UsedC
|
|||
_image_compress_bptc_func = p_compress_func;
|
||||
}
|
||||
|
||||
void Image::normalmap_to_xy() {
|
||||
void Image::normal_map_to_xy() {
|
||||
convert(Image::FORMAT_RGBA8);
|
||||
|
||||
{
|
||||
|
@ -3285,7 +3285,7 @@ Ref<Image> Image::get_image_from_mipmap(int p_mipamp) const {
|
|||
return image;
|
||||
}
|
||||
|
||||
void Image::bumpmap_to_normalmap(float bump_scale) {
|
||||
void Image::bump_map_to_normal_map(float bump_scale) {
|
||||
ERR_FAIL_COND(!_can_modify(format));
|
||||
convert(Image::FORMAT_RF);
|
||||
|
||||
|
|
|
@ -350,10 +350,10 @@ public:
|
|||
void fix_alpha_edges();
|
||||
void premultiply_alpha();
|
||||
void srgb_to_linear();
|
||||
void normalmap_to_xy();
|
||||
void normal_map_to_xy();
|
||||
Ref<Image> rgbe_to_srgb();
|
||||
Ref<Image> get_image_from_mipmap(int p_mipamp) const;
|
||||
void bumpmap_to_normalmap(float bump_scale = 1.0);
|
||||
void bump_map_to_normal_map(float bump_scale = 1.0);
|
||||
|
||||
void blit_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const Point2 &p_dest);
|
||||
void blit_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, const Rect2 &p_src_rect, const Point2 &p_dest);
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
Will perform a UV unwrap on the [ArrayMesh] to prepare the mesh for lightmapping.
|
||||
</description>
|
||||
</method>
|
||||
<method name="regen_normalmaps">
|
||||
<method name="regen_normal_maps">
|
||||
<return type="void">
|
||||
</return>
|
||||
<description>
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
[Texture2D] with the emission [Color] of the Decal. Either this or the [member texture_emission] must be set for the Decal to be visible. Use the alpha channel like a mask to smoothly blend the edges of the decal with the underlying object.
|
||||
</member>
|
||||
<member name="texture_normal" type="Texture2D" setter="set_texture" getter="get_texture">
|
||||
[Texture2D] with the per-pixel normalmap for the decal. Use this to add extra detail to decals.
|
||||
[Texture2D] with the per-pixel normal map for the decal. Use this to add extra detail to decals.
|
||||
</member>
|
||||
<member name="texture_orm" type="Texture2D" setter="set_texture" getter="get_texture">
|
||||
[Texture2D] storing ambient occlusion, roughness, and metallic for the decal. Use this to add extra detail to decals.
|
||||
|
|
|
@ -68,13 +68,13 @@
|
|||
Blits [code]src_rect[/code] area from [code]src[/code] image to this image at the coordinates given by [code]dst[/code]. [code]src[/code] pixel is copied onto [code]dst[/code] if the corresponding [code]mask[/code] pixel's alpha value is not 0. [code]src[/code] image and [code]mask[/code] image [b]must[/b] have the same size (width and height) but they can have different formats.
|
||||
</description>
|
||||
</method>
|
||||
<method name="bumpmap_to_normalmap">
|
||||
<method name="bump_map_to_normal_map">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="bump_scale" type="float" default="1.0">
|
||||
</argument>
|
||||
<description>
|
||||
Converts a bumpmap to a normalmap. A bumpmap provides a height offset per-pixel, while a normalmap provides a normal direction per pixel.
|
||||
Converts a bump map to a normal map. A bump map provides a height offset per-pixel, while a normal map provides a normal direction per pixel.
|
||||
</description>
|
||||
</method>
|
||||
<method name="clear_mipmaps">
|
||||
|
@ -398,11 +398,11 @@
|
|||
Loads an image from the binary contents of a WebP file.
|
||||
</description>
|
||||
</method>
|
||||
<method name="normalmap_to_xy">
|
||||
<method name="normal_map_to_xy">
|
||||
<return type="void">
|
||||
</return>
|
||||
<description>
|
||||
Converts the image's data to represent coordinates on a 3D plane. This is used when the image represents a normalmap. A normalmap can add lots of detail to a 3D surface without increasing the polygon count.
|
||||
Converts the image's data to represent coordinates on a 3D plane. This is used when the image represents a normal map. A normal map can add lots of detail to a 3D surface without increasing the polygon count.
|
||||
</description>
|
||||
</method>
|
||||
<method name="premultiply_alpha">
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<constant name="TYPE_COLOR" value="1" enum="TextureType">
|
||||
Adds [code]hint_albedo[/code] as hint to the uniform declaration for proper sRGB to linear conversion.
|
||||
</constant>
|
||||
<constant name="TYPE_NORMALMAP" value="2" enum="TextureType">
|
||||
<constant name="TYPE_NORMAL_MAP" value="2" enum="TextureType">
|
||||
Adds [code]hint_normal[/code] as hint to the uniform declaration, which internally converts the texture for proper usage as normal map.
|
||||
</constant>
|
||||
</constants>
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<constant name="TYPE_COLOR" value="1" enum="TextureType">
|
||||
Adds [code]hint_albedo[/code] as hint to the uniform declaration for proper sRGB to linear conversion.
|
||||
</constant>
|
||||
<constant name="TYPE_NORMALMAP" value="2" enum="TextureType">
|
||||
<constant name="TYPE_NORMAL_MAP" value="2" enum="TextureType">
|
||||
Adds [code]hint_normal[/code] as hint to the uniform declaration, which internally converts the texture for proper usage as normal map.
|
||||
</constant>
|
||||
</constants>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<constant name="TYPE_COLOR" value="1" enum="TextureType">
|
||||
Adds [code]hint_albedo[/code] as hint to the uniform declaration for proper sRGB to linear conversion.
|
||||
</constant>
|
||||
<constant name="TYPE_NORMALMAP" value="2" enum="TextureType">
|
||||
<constant name="TYPE_NORMAL_MAP" value="2" enum="TextureType">
|
||||
Adds [code]hint_normal[/code] as hint to the uniform declaration, which internally converts the texture for proper usage as normal map.
|
||||
</constant>
|
||||
<constant name="TYPE_ANISO" value="3" enum="TextureType">
|
||||
|
|
|
@ -216,7 +216,7 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) {
|
|||
format = basist::transcoder_texture_format::cTFETC2; // get this from renderer
|
||||
imgfmt = Image::FORMAT_ETC2_RGBA8;
|
||||
} else {
|
||||
//gles2 most likely, bad for normalmaps, nothing to do about this.
|
||||
//gles2 most likely, bad for normal maps, nothing to do about this.
|
||||
format = basist::transcoder_texture_format::cTFRGBA32;
|
||||
imgfmt = Image::FORMAT_RGBA8;
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::UsedChann
|
|||
|
||||
flags |= cvtt::Flags::BC7_RespectPunchThrough;
|
||||
|
||||
if (p_channels == Image::USED_CHANNELS_RG) { //guessing this is a normalmap
|
||||
if (p_channels == Image::USED_CHANNELS_RG) { //guessing this is a normal map
|
||||
flags |= cvtt::Flags::Uniform;
|
||||
}
|
||||
options.flags = flags;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</brief_description>
|
||||
<description>
|
||||
Uses an [OpenSimplexNoise] to fill the texture data. You can specify the texture size but keep in mind that larger textures will take longer to generate and seamless noise only works with square sized textures.
|
||||
NoiseTexture can also generate normalmap textures.
|
||||
NoiseTexture can also generate normal map textures.
|
||||
The class uses [Thread]s to generate the texture data internally, so [method Texture2D.get_data] may return [code]null[/code] if the generation process has not completed yet. In that case, you need to wait for the texture to be generated before accessing the data:
|
||||
[codeblock]
|
||||
var texture = preload("res://noise.tres")
|
||||
|
@ -18,7 +18,7 @@
|
|||
<methods>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="as_normalmap" type="bool" setter="set_as_normalmap" getter="is_normalmap" default="false">
|
||||
<member name="as_normal_map" type="bool" setter="set_as_normal_map" getter="is_normal_map" default="false">
|
||||
If [code]true[/code], the resulting texture contains a normal map created from the original noise interpreted as a bump map.
|
||||
</member>
|
||||
<member name="bump_strength" type="float" setter="set_bump_strength" getter="get_bump_strength" default="8.0">
|
||||
|
|
|
@ -40,7 +40,7 @@ NoiseTexture::NoiseTexture() {
|
|||
|
||||
size = Vector2i(512, 512);
|
||||
seamless = false;
|
||||
as_normalmap = false;
|
||||
as_normal_map = false;
|
||||
bump_strength = 8.0;
|
||||
|
||||
noise = Ref<OpenSimplexNoise>();
|
||||
|
@ -68,8 +68,8 @@ void NoiseTexture::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_seamless", "seamless"), &NoiseTexture::set_seamless);
|
||||
ClassDB::bind_method(D_METHOD("get_seamless"), &NoiseTexture::get_seamless);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_as_normalmap", "as_normalmap"), &NoiseTexture::set_as_normalmap);
|
||||
ClassDB::bind_method(D_METHOD("is_normalmap"), &NoiseTexture::is_normalmap);
|
||||
ClassDB::bind_method(D_METHOD("set_as_normal_map", "as_normal_map"), &NoiseTexture::set_as_normal_map);
|
||||
ClassDB::bind_method(D_METHOD("is_normal_map"), &NoiseTexture::is_normal_map);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_bump_strength", "bump_strength"), &NoiseTexture::set_bump_strength);
|
||||
ClassDB::bind_method(D_METHOD("get_bump_strength"), &NoiseTexture::get_bump_strength);
|
||||
|
@ -81,14 +81,14 @@ void NoiseTexture::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::INT, "width", PROPERTY_HINT_RANGE, "1,2048,1,or_greater"), "set_width", "get_width");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "height", PROPERTY_HINT_RANGE, "1,2048,1,or_greater"), "set_height", "get_height");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "seamless"), "set_seamless", "get_seamless");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "as_normalmap"), "set_as_normalmap", "is_normalmap");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "as_normal_map"), "set_as_normal_map", "is_normal_map");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bump_strength", PROPERTY_HINT_RANGE, "0,32,0.1,or_greater"), "set_bump_strength", "get_bump_strength");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "noise", PROPERTY_HINT_RESOURCE_TYPE, "OpenSimplexNoise"), "set_noise", "get_noise");
|
||||
}
|
||||
|
||||
void NoiseTexture::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "bump_strength") {
|
||||
if (!as_normalmap) {
|
||||
if (!as_normal_map) {
|
||||
property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL;
|
||||
}
|
||||
}
|
||||
|
@ -148,8 +148,8 @@ Ref<Image> NoiseTexture::_generate_texture() {
|
|||
image = ref_noise->get_image(size.x, size.y);
|
||||
}
|
||||
|
||||
if (as_normalmap) {
|
||||
image->bumpmap_to_normalmap(bump_strength);
|
||||
if (as_normal_map) {
|
||||
image->bump_map_to_normal_map(bump_strength);
|
||||
}
|
||||
|
||||
return image;
|
||||
|
@ -225,17 +225,17 @@ bool NoiseTexture::get_seamless() {
|
|||
return seamless;
|
||||
}
|
||||
|
||||
void NoiseTexture::set_as_normalmap(bool p_as_normalmap) {
|
||||
if (p_as_normalmap == as_normalmap) {
|
||||
void NoiseTexture::set_as_normal_map(bool p_as_normal_map) {
|
||||
if (p_as_normal_map == as_normal_map) {
|
||||
return;
|
||||
}
|
||||
as_normalmap = p_as_normalmap;
|
||||
as_normal_map = p_as_normal_map;
|
||||
_queue_update();
|
||||
_change_notify();
|
||||
}
|
||||
|
||||
bool NoiseTexture::is_normalmap() {
|
||||
return as_normalmap;
|
||||
bool NoiseTexture::is_normal_map() {
|
||||
return as_normal_map;
|
||||
}
|
||||
|
||||
void NoiseTexture::set_bump_strength(float p_bump_strength) {
|
||||
|
@ -243,7 +243,7 @@ void NoiseTexture::set_bump_strength(float p_bump_strength) {
|
|||
return;
|
||||
}
|
||||
bump_strength = p_bump_strength;
|
||||
if (as_normalmap) {
|
||||
if (as_normal_map) {
|
||||
_queue_update();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ private:
|
|||
Ref<OpenSimplexNoise> noise;
|
||||
Vector2i size;
|
||||
bool seamless;
|
||||
bool as_normalmap;
|
||||
bool as_normal_map;
|
||||
float bump_strength;
|
||||
|
||||
void _thread_done(const Ref<Image> &p_image);
|
||||
|
@ -82,8 +82,8 @@ public:
|
|||
void set_seamless(bool p_seamless);
|
||||
bool get_seamless();
|
||||
|
||||
void set_as_normalmap(bool p_as_normalmap);
|
||||
bool is_normalmap();
|
||||
void set_as_normal_map(bool p_as_normal_map);
|
||||
bool is_normal_map();
|
||||
|
||||
void set_bump_strength(float p_bump_strength);
|
||||
float get_bump_strength();
|
||||
|
|
|
@ -969,11 +969,11 @@ void BaseMaterial3D::_update_shader() {
|
|||
|
||||
if (features[FEATURE_NORMAL_MAPPING]) {
|
||||
if (flags[FLAG_UV1_USE_TRIPLANAR]) {
|
||||
code += "\tNORMALMAP = triplanar_texture(texture_normal,uv1_power_normal,uv1_triplanar_pos).rgb;\n";
|
||||
code += "\tNORMAL_MAP = triplanar_texture(texture_normal,uv1_power_normal,uv1_triplanar_pos).rgb;\n";
|
||||
} else {
|
||||
code += "\tNORMALMAP = texture(texture_normal,base_uv).rgb;\n";
|
||||
code += "\tNORMAL_MAP = texture(texture_normal,base_uv).rgb;\n";
|
||||
}
|
||||
code += "\tNORMALMAP_DEPTH = normal_scale;\n";
|
||||
code += "\tNORMAL_MAP_DEPTH = normal_scale;\n";
|
||||
}
|
||||
|
||||
if (features[FEATURE_EMISSION]) {
|
||||
|
@ -1000,7 +1000,7 @@ void BaseMaterial3D::_update_shader() {
|
|||
|
||||
if (features[FEATURE_REFRACTION]) {
|
||||
if (features[FEATURE_NORMAL_MAPPING]) {
|
||||
code += "\tvec3 ref_normal = normalize( mix(NORMAL,TANGENT * NORMALMAP.x + BINORMAL * NORMALMAP.y + NORMAL * NORMALMAP.z,NORMALMAP_DEPTH) );\n";
|
||||
code += "\tvec3 ref_normal = normalize( mix(NORMAL,TANGENT * NORMAL_MAP.x + BINORMAL * NORMAL_MAP.y + NORMAL * NORMAL_MAP.z,NORMAL_MAP_DEPTH) );\n";
|
||||
} else {
|
||||
code += "\tvec3 ref_normal = NORMAL;\n";
|
||||
}
|
||||
|
@ -1198,8 +1198,8 @@ void BaseMaterial3D::_update_shader() {
|
|||
break; // Internal value, skip.
|
||||
}
|
||||
|
||||
code += "\tvec3 detail_norm = mix(NORMALMAP,detail_norm_tex.rgb,detail_tex.a);\n";
|
||||
code += "\tNORMALMAP = mix(NORMALMAP,detail_norm,detail_mask_tex.r);\n";
|
||||
code += "\tvec3 detail_norm = mix(NORMAL_MAP,detail_norm_tex.rgb,detail_tex.a);\n";
|
||||
code += "\tNORMAL_MAP = mix(NORMAL_MAP,detail_norm,detail_mask_tex.r);\n";
|
||||
code += "\tALBEDO.rgb = mix(ALBEDO.rgb,detail,detail_mask_tex.r);\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -1350,7 +1350,7 @@ AABB ArrayMesh::get_custom_aabb() const {
|
|||
return custom_aabb;
|
||||
}
|
||||
|
||||
void ArrayMesh::regen_normalmaps() {
|
||||
void ArrayMesh::regen_normal_maps() {
|
||||
if (surfaces.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -1586,8 +1586,8 @@ void ArrayMesh::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("create_trimesh_shape"), &ArrayMesh::create_trimesh_shape);
|
||||
ClassDB::bind_method(D_METHOD("create_convex_shape"), &ArrayMesh::create_convex_shape);
|
||||
ClassDB::bind_method(D_METHOD("create_outline", "margin"), &ArrayMesh::create_outline);
|
||||
ClassDB::bind_method(D_METHOD("regen_normalmaps"), &ArrayMesh::regen_normalmaps);
|
||||
ClassDB::set_method_flags(get_class_static(), _scs_create("regen_normalmaps"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
|
||||
ClassDB::bind_method(D_METHOD("regen_normal_maps"), &ArrayMesh::regen_normal_maps);
|
||||
ClassDB::set_method_flags(get_class_static(), _scs_create("regen_normal_maps"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
|
||||
ClassDB::bind_method(D_METHOD("lightmap_unwrap", "transform", "texel_size"), &ArrayMesh::lightmap_unwrap);
|
||||
ClassDB::set_method_flags(get_class_static(), _scs_create("lightmap_unwrap"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
|
||||
ClassDB::bind_method(D_METHOD("get_faces"), &ArrayMesh::get_faces);
|
||||
|
|
|
@ -252,7 +252,7 @@ public:
|
|||
AABB get_aabb() const override;
|
||||
virtual RID get_rid() const override;
|
||||
|
||||
void regen_normalmaps();
|
||||
void regen_normal_maps();
|
||||
|
||||
Error lightmap_unwrap(const Transform &p_base_transform = Transform(), float p_texel_size = 0.05);
|
||||
Error lightmap_unwrap_cached(int *&r_cache_data, unsigned int &r_cache_size, bool &r_used_cache, const Transform &p_base_transform = Transform(), float p_texel_size = 0.05);
|
||||
|
|
|
@ -2359,8 +2359,8 @@ const VisualShaderNodeOutput::Port VisualShaderNodeOutput::ports[] = {
|
|||
{ Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "ao", "AO" },
|
||||
|
||||
{ Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "normal", "NORMAL" },
|
||||
{ Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "normalmap", "NORMALMAP" },
|
||||
{ Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "normalmap_depth", "NORMALMAP_DEPTH" },
|
||||
{ Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "normal_map", "NORMAL_MAP" },
|
||||
{ Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "normal_map_depth", "NORMAL_MAP_DEPTH" },
|
||||
|
||||
{ Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "rim", "RIM" },
|
||||
{ Shader::MODE_SPATIAL, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "rim_tint", "RIM_TINT" },
|
||||
|
@ -2386,8 +2386,8 @@ const VisualShaderNodeOutput::Port VisualShaderNodeOutput::ports[] = {
|
|||
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR.rgb" },
|
||||
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "COLOR.a" },
|
||||
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "normal", "NORMAL" },
|
||||
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "normalmap", "NORMALMAP" },
|
||||
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "normalmap_depth", "NORMALMAP_DEPTH" },
|
||||
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "normal_map", "NORMAL_MAP" },
|
||||
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "normal_map_depth", "NORMAL_MAP_DEPTH" },
|
||||
// Canvas Item, Light
|
||||
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR, "light", "LIGHT.rgb" },
|
||||
{ Shader::MODE_CANVAS_ITEM, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_SCALAR, "light_alpha", "LIGHT.a" },
|
||||
|
|
|
@ -480,7 +480,7 @@ String VisualShaderNodeTexture::generate_global(Shader::Mode p_mode, VisualShade
|
|||
case TYPE_COLOR:
|
||||
u += " : hint_albedo";
|
||||
break;
|
||||
case TYPE_NORMALMAP:
|
||||
case TYPE_NORMAL_MAP:
|
||||
u += " : hint_normal";
|
||||
break;
|
||||
}
|
||||
|
@ -780,7 +780,7 @@ void VisualShaderNodeTexture::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(SOURCE_PORT);
|
||||
BIND_ENUM_CONSTANT(TYPE_DATA);
|
||||
BIND_ENUM_CONSTANT(TYPE_COLOR);
|
||||
BIND_ENUM_CONSTANT(TYPE_NORMALMAP);
|
||||
BIND_ENUM_CONSTANT(TYPE_NORMAL_MAP);
|
||||
}
|
||||
|
||||
VisualShaderNodeTexture::VisualShaderNodeTexture() {
|
||||
|
@ -1181,7 +1181,7 @@ String VisualShaderNodeCubemap::generate_global(Shader::Mode p_mode, VisualShade
|
|||
case TYPE_COLOR:
|
||||
u += " : hint_albedo";
|
||||
break;
|
||||
case TYPE_NORMALMAP:
|
||||
case TYPE_NORMAL_MAP:
|
||||
u += " : hint_normal";
|
||||
break;
|
||||
}
|
||||
|
@ -1310,7 +1310,7 @@ void VisualShaderNodeCubemap::_bind_methods() {
|
|||
|
||||
BIND_ENUM_CONSTANT(TYPE_DATA);
|
||||
BIND_ENUM_CONSTANT(TYPE_COLOR);
|
||||
BIND_ENUM_CONSTANT(TYPE_NORMALMAP);
|
||||
BIND_ENUM_CONSTANT(TYPE_NORMAL_MAP);
|
||||
}
|
||||
|
||||
VisualShaderNodeCubemap::VisualShaderNodeCubemap() {
|
||||
|
@ -4350,7 +4350,7 @@ String VisualShaderNodeTextureUniform::generate_global(Shader::Mode p_mode, Visu
|
|||
code += " : hint_albedo;\n";
|
||||
}
|
||||
break;
|
||||
case TYPE_NORMALMAP:
|
||||
case TYPE_NORMAL_MAP:
|
||||
code += " : hint_normal;\n";
|
||||
break;
|
||||
case TYPE_ANISO:
|
||||
|
@ -4431,7 +4431,7 @@ void VisualShaderNodeTextureUniform::_bind_methods() {
|
|||
|
||||
BIND_ENUM_CONSTANT(TYPE_DATA);
|
||||
BIND_ENUM_CONSTANT(TYPE_COLOR);
|
||||
BIND_ENUM_CONSTANT(TYPE_NORMALMAP);
|
||||
BIND_ENUM_CONSTANT(TYPE_NORMAL_MAP);
|
||||
BIND_ENUM_CONSTANT(TYPE_ANISO);
|
||||
|
||||
BIND_ENUM_CONSTANT(COLOR_DEFAULT_WHITE);
|
||||
|
@ -4608,7 +4608,7 @@ String VisualShaderNodeTexture2DArrayUniform::generate_global(Shader::Mode p_mod
|
|||
else
|
||||
code += " : hint_albedo;\n";
|
||||
break;
|
||||
case TYPE_NORMALMAP:
|
||||
case TYPE_NORMAL_MAP:
|
||||
code += " : hint_normal;\n";
|
||||
break;
|
||||
case TYPE_ANISO:
|
||||
|
@ -4676,7 +4676,7 @@ String VisualShaderNodeTexture3DUniform::generate_global(Shader::Mode p_mode, Vi
|
|||
else
|
||||
code += " : hint_albedo;\n";
|
||||
break;
|
||||
case TYPE_NORMALMAP:
|
||||
case TYPE_NORMAL_MAP:
|
||||
code += " : hint_normal;\n";
|
||||
break;
|
||||
case TYPE_ANISO:
|
||||
|
@ -4746,7 +4746,7 @@ String VisualShaderNodeCubemapUniform::generate_global(Shader::Mode p_mode, Visu
|
|||
code += " : hint_albedo;\n";
|
||||
}
|
||||
break;
|
||||
case TYPE_NORMALMAP:
|
||||
case TYPE_NORMAL_MAP:
|
||||
code += " : hint_normal;\n";
|
||||
break;
|
||||
case TYPE_ANISO:
|
||||
|
|
|
@ -236,7 +236,7 @@ public:
|
|||
enum TextureType {
|
||||
TYPE_DATA,
|
||||
TYPE_COLOR,
|
||||
TYPE_NORMALMAP,
|
||||
TYPE_NORMAL_MAP,
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -412,7 +412,7 @@ public:
|
|||
enum TextureType {
|
||||
TYPE_DATA,
|
||||
TYPE_COLOR,
|
||||
TYPE_NORMALMAP
|
||||
TYPE_NORMAL_MAP
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -1834,7 +1834,7 @@ public:
|
|||
enum TextureType {
|
||||
TYPE_DATA,
|
||||
TYPE_COLOR,
|
||||
TYPE_NORMALMAP,
|
||||
TYPE_NORMAL_MAP,
|
||||
TYPE_ANISO,
|
||||
};
|
||||
|
||||
|
|
|
@ -2488,8 +2488,8 @@ RendererCanvasRenderRD::RendererCanvasRenderRD(RendererStorageRD *p_storage) {
|
|||
|
||||
actions.renames["COLOR"] = "color";
|
||||
actions.renames["NORMAL"] = "normal";
|
||||
actions.renames["NORMALMAP"] = "normal_map";
|
||||
actions.renames["NORMALMAP_DEPTH"] = "normal_depth";
|
||||
actions.renames["NORMAL_MAP"] = "normal_map";
|
||||
actions.renames["NORMAL_MAP_DEPTH"] = "normal_depth";
|
||||
actions.renames["TEXTURE"] = "color_texture";
|
||||
actions.renames["TEXTURE_PIXEL_SIZE"] = "draw_data.color_texture_pixel_size";
|
||||
actions.renames["NORMAL_TEXTURE"] = "normal_texture";
|
||||
|
@ -2517,7 +2517,7 @@ RendererCanvasRenderRD::RendererCanvasRenderRD(RendererStorageRD *p_storage) {
|
|||
actions.usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n";
|
||||
actions.usage_defines["SCREEN_PIXEL_SIZE"] = "@SCREEN_UV";
|
||||
actions.usage_defines["NORMAL"] = "#define NORMAL_USED\n";
|
||||
actions.usage_defines["NORMALMAP"] = "#define NORMALMAP_USED\n";
|
||||
actions.usage_defines["NORMAL_MAP"] = "#define NORMAL_MAP_USED\n";
|
||||
actions.usage_defines["LIGHT"] = "#define LIGHT_SHADER_CODE_USED\n";
|
||||
|
||||
actions.render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
|
||||
|
|
|
@ -112,7 +112,7 @@ void RendererSceneRenderForward::ShaderData::set_code(const String &p_code) {
|
|||
actions.usage_flag_pointers["TIME"] = &uses_time;
|
||||
actions.usage_flag_pointers["ROUGHNESS"] = &uses_roughness;
|
||||
actions.usage_flag_pointers["NORMAL"] = &uses_normal;
|
||||
actions.usage_flag_pointers["NORMALMAP"] = &uses_normal;
|
||||
actions.usage_flag_pointers["NORMAL_MAP"] = &uses_normal;
|
||||
|
||||
actions.usage_flag_pointers["POINT_SIZE"] = &uses_point_size;
|
||||
actions.usage_flag_pointers["POINT_COORD"] = &uses_point_size;
|
||||
|
@ -2867,8 +2867,8 @@ RendererSceneRenderForward::RendererSceneRenderForward(RendererStorageRD *p_stor
|
|||
|
||||
actions.renames["FRAGCOORD"] = "gl_FragCoord";
|
||||
actions.renames["FRONT_FACING"] = "gl_FrontFacing";
|
||||
actions.renames["NORMALMAP"] = "normalmap";
|
||||
actions.renames["NORMALMAP_DEPTH"] = "normaldepth";
|
||||
actions.renames["NORMAL_MAP"] = "normal_map";
|
||||
actions.renames["NORMAL_MAP_DEPTH"] = "normal_map_depth";
|
||||
actions.renames["ALBEDO"] = "albedo";
|
||||
actions.renames["ALPHA"] = "alpha";
|
||||
actions.renames["METALLIC"] = "metallic";
|
||||
|
@ -2935,8 +2935,8 @@ RendererSceneRenderForward::RendererSceneRenderForward(RendererStorageRD *p_stor
|
|||
actions.usage_defines["CUSTOM1"] = "#define CUSTOM1\n";
|
||||
actions.usage_defines["CUSTOM2"] = "#define CUSTOM2\n";
|
||||
actions.usage_defines["CUSTOM3"] = "#define CUSTOM3\n";
|
||||
actions.usage_defines["NORMALMAP"] = "#define NORMALMAP_USED\n";
|
||||
actions.usage_defines["NORMALMAP_DEPTH"] = "@NORMALMAP";
|
||||
actions.usage_defines["NORMAL_MAP"] = "#define NORMAL_MAP_USED\n";
|
||||
actions.usage_defines["NORMAL_MAP_DEPTH"] = "@NORMAL_MAP";
|
||||
actions.usage_defines["COLOR"] = "#define COLOR_USED\n";
|
||||
actions.usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
|
||||
actions.usage_defines["POSITION"] = "#define OVERRIDE_POSITION\n";
|
||||
|
|
|
@ -1234,7 +1234,7 @@ void RendererStorageRD::canvas_texture_set_channel(RID p_canvas_texture, RS::Can
|
|||
ct->diffuse = p_texture;
|
||||
} break;
|
||||
case RS::CANVAS_TEXTURE_CHANNEL_NORMAL: {
|
||||
ct->normalmap = p_texture;
|
||||
ct->normal_map = p_texture;
|
||||
} break;
|
||||
case RS::CANVAS_TEXTURE_CHANNEL_SPECULAR: {
|
||||
ct->specular = p_texture;
|
||||
|
@ -1316,7 +1316,7 @@ bool RendererStorageRD::canvas_texture_get_uniform_set(RID p_texture, RS::Canvas
|
|||
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
|
||||
u.binding = 1;
|
||||
|
||||
t = texture_owner.getornull(ct->normalmap);
|
||||
t = texture_owner.getornull(ct->normal_map);
|
||||
if (!t) {
|
||||
u.ids.push_back(texture_rd_get_default(DEFAULT_RD_TEXTURE_NORMAL));
|
||||
ct->use_normal_cache = false;
|
||||
|
|
|
@ -187,7 +187,7 @@ private:
|
|||
|
||||
struct CanvasTexture {
|
||||
RID diffuse;
|
||||
RID normalmap;
|
||||
RID normal_map;
|
||||
RID specular;
|
||||
Color specular_color = Color(1, 1, 1, 1);
|
||||
float shininess = 1.0;
|
||||
|
|
|
@ -1340,8 +1340,8 @@ ShaderCompilerRD::ShaderCompilerRD() {
|
|||
|
||||
actions[RS::SHADER_SPATIAL].renames["FRAGCOORD"] = "gl_FragCoord";
|
||||
actions[RS::SHADER_SPATIAL].renames["FRONT_FACING"] = "gl_FrontFacing";
|
||||
actions[RS::SHADER_SPATIAL].renames["NORMALMAP"] = "normalmap";
|
||||
actions[RS::SHADER_SPATIAL].renames["NORMALMAP_DEPTH"] = "normaldepth";
|
||||
actions[RS::SHADER_SPATIAL].renames["NORMAL_MAP"] = "normal_map";
|
||||
actions[RS::SHADER_SPATIAL].renames["NORMAL_MAP_DEPTH"] = "normal_map_depth";
|
||||
actions[RS::SHADER_SPATIAL].renames["ALBEDO"] = "albedo";
|
||||
actions[RS::SHADER_SPATIAL].renames["ALPHA"] = "alpha";
|
||||
actions[RS::SHADER_SPATIAL].renames["METALLIC"] = "metallic";
|
||||
|
@ -1387,8 +1387,8 @@ ShaderCompilerRD::ShaderCompilerRD() {
|
|||
actions[RS::SHADER_SPATIAL].usage_defines["AO_LIGHT_AFFECT"] = "#define ENABLE_AO\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["UV"] = "#define ENABLE_UV_INTERP\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["UV2"] = "#define ENABLE_UV2_INTERP\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["NORMALMAP"] = "#define ENABLE_NORMALMAP\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["NORMALMAP_DEPTH"] = "@NORMALMAP";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["NORMAL_MAP"] = "#define ENABLE_NORMAL_MAP\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["NORMAL_MAP_DEPTH"] = "@NORMAL_MAP";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n";
|
||||
|
|
|
@ -499,7 +499,7 @@ void main() {
|
|||
{
|
||||
float normal_depth = 1.0;
|
||||
|
||||
#if defined(NORMALMAP_USED)
|
||||
#if defined(NORMAL_MAP_USED)
|
||||
vec3 normal_map = vec3(0.0, 0.0, 1.0);
|
||||
normal_used = true;
|
||||
#endif
|
||||
|
@ -510,7 +510,7 @@ FRAGMENT_SHADER_CODE
|
|||
|
||||
/* clang-format on */
|
||||
|
||||
#if defined(NORMALMAP_USED)
|
||||
#if defined(NORMAL_MAP_USED)
|
||||
normal = mix(vec3(0.0, 0.0, 1.0), normal_map * vec3(2.0, -2.0, 1.0) - vec3(1.0, -1.0, 0.0), normal_depth);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ layout(location = 0) in vec3 vertex_attrib;
|
|||
layout(location = 1) in vec3 normal_attrib;
|
||||
#endif
|
||||
|
||||
#if defined(TANGENT_USED) || defined(NORMALMAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
layout(location = 2) in vec4 tangent_attrib;
|
||||
#endif
|
||||
|
||||
|
@ -76,7 +76,7 @@ layout(location = 3) out vec2 uv_interp;
|
|||
layout(location = 4) out vec2 uv2_interp;
|
||||
#endif
|
||||
|
||||
#if defined(TANGENT_USED) || defined(NORMALMAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
layout(location = 5) out vec3 tangent_interp;
|
||||
layout(location = 6) out vec3 binormal_interp;
|
||||
#endif
|
||||
|
@ -155,7 +155,7 @@ void main() {
|
|||
vec3 normal = normal_attrib * 2.0 - 1.0;
|
||||
#endif
|
||||
|
||||
#if defined(TANGENT_USED) || defined(NORMALMAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
vec3 tangent = tangent_attrib.xyz * 2.0 - 1.0;
|
||||
float binormalf = tangent_attrib.a * 2.0 - 1.0;
|
||||
vec3 binormal = normalize(cross(normal, tangent) * binormalf);
|
||||
|
@ -179,7 +179,7 @@ void main() {
|
|||
vertex = (vec4(vertex, 1.0) * m).xyz;
|
||||
normal = (vec4(normal, 0.0) * m).xyz;
|
||||
|
||||
#if defined(TANGENT_USED) || defined(NORMALMAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
|
||||
tangent = (vec4(tangent, 0.0) * m).xyz;
|
||||
binormal = (vec4(binormal, 0.0) * m).xyz;
|
||||
|
@ -208,7 +208,7 @@ void main() {
|
|||
|
||||
normal = world_normal_matrix * normal;
|
||||
|
||||
#if defined(TANGENT_USED) || defined(NORMALMAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
|
||||
tangent = world_normal_matrix * tangent;
|
||||
binormal = world_normal_matrix * binormal;
|
||||
|
@ -239,7 +239,7 @@ VERTEX_SHADER_CODE
|
|||
|
||||
#endif
|
||||
|
||||
#if defined(TANGENT_USED) || defined(NORMALMAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
|
||||
binormal = modelview_normal * binormal;
|
||||
tangent = modelview_normal * tangent;
|
||||
|
@ -251,7 +251,7 @@ VERTEX_SHADER_CODE
|
|||
vertex = (scene_data.inv_camera_matrix * vec4(vertex, 1.0)).xyz;
|
||||
normal = mat3(scene_data.inverse_normal_matrix) * normal;
|
||||
|
||||
#if defined(TANGENT_USED) || defined(NORMALMAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
|
||||
binormal = mat3(scene_data.camera_inverse_binormal_matrix) * binormal;
|
||||
tangent = mat3(scene_data.camera_inverse_tangent_matrix) * tangent;
|
||||
|
@ -263,7 +263,7 @@ VERTEX_SHADER_CODE
|
|||
normal_interp = normal;
|
||||
#endif
|
||||
|
||||
#if defined(TANGENT_USED) || defined(NORMALMAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
tangent_interp = tangent;
|
||||
binormal_interp = binormal;
|
||||
#endif
|
||||
|
@ -340,7 +340,7 @@ layout(location = 3) in vec2 uv_interp;
|
|||
layout(location = 4) in vec2 uv2_interp;
|
||||
#endif
|
||||
|
||||
#if defined(TANGENT_USED) || defined(NORMALMAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
layout(location = 5) in vec3 tangent_interp;
|
||||
layout(location = 6) in vec3 binormal_interp;
|
||||
#endif
|
||||
|
@ -1819,7 +1819,7 @@ void main() {
|
|||
|
||||
float alpha = 1.0;
|
||||
|
||||
#if defined(TANGENT_USED) || defined(NORMALMAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
|
||||
vec3 binormal = normalize(binormal_interp);
|
||||
vec3 tangent = normalize(tangent_interp);
|
||||
#else
|
||||
|
@ -1850,12 +1850,12 @@ void main() {
|
|||
vec4 color = color_interp;
|
||||
#endif
|
||||
|
||||
#if defined(NORMALMAP_USED)
|
||||
#if defined(NORMAL_MAP_USED)
|
||||
|
||||
vec3 normalmap = vec3(0.5);
|
||||
vec3 normal_map = vec3(0.5);
|
||||
#endif
|
||||
|
||||
float normaldepth = 1.0;
|
||||
float normal_depth = 1.0;
|
||||
|
||||
vec2 screen_uv = gl_FragCoord.xy * scene_data.screen_pixel_size + scene_data.screen_pixel_size * 0.5; //account for center
|
||||
|
||||
|
@ -1926,12 +1926,12 @@ FRAGMENT_SHADER_CODE
|
|||
|
||||
#endif // !USE_SHADOW_TO_OPACITY
|
||||
|
||||
#ifdef NORMALMAP_USED
|
||||
#ifdef NORMAL_MAP_USED
|
||||
|
||||
normalmap.xy = normalmap.xy * 2.0 - 1.0;
|
||||
normalmap.z = sqrt(max(0.0, 1.0 - dot(normalmap.xy, normalmap.xy))); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc.
|
||||
normal_map.xy = normal_map.xy * 2.0 - 1.0;
|
||||
normal_map.z = sqrt(max(0.0, 1.0 - dot(normal_map.xy, normal_map.xy))); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc.
|
||||
|
||||
normal = normalize(mix(normal, tangent * normalmap.x + binormal * normalmap.y + normal * normalmap.z, normaldepth));
|
||||
normal = normalize(mix(normal, tangent * normal_map.x + binormal * normal_map.y + normal * normal_map.z, normal_depth));
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "cluster_data_inc.glsl"
|
||||
|
||||
#if !defined(MODE_RENDER_DEPTH) || defined(MODE_RENDER_MATERIAL) || defined(MODE_RENDER_SDF) || defined(MODE_RENDER_NORMAL_ROUGHNESS) || defined(MODE_RENDER_GIPROBE) || defined(TANGENT_USED) || defined(NORMALMAP_USED)
|
||||
#if !defined(MODE_RENDER_DEPTH) || defined(MODE_RENDER_MATERIAL) || defined(MODE_RENDER_SDF) || defined(MODE_RENDER_NORMAL_ROUGHNESS) || defined(MODE_RENDER_GIPROBE) || defined(TANGENT_USED) || defined(NORMAL_MAP_USED)
|
||||
#ifndef NORMAL_USED
|
||||
#define NORMAL_USED
|
||||
#endif
|
||||
|
|
|
@ -94,8 +94,8 @@ ShaderTypes::ShaderTypes() {
|
|||
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["TANGENT"] = ShaderLanguage::TYPE_VEC3;
|
||||
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["BINORMAL"] = ShaderLanguage::TYPE_VEC3;
|
||||
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEW"] = constt(ShaderLanguage::TYPE_VEC3);
|
||||
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMALMAP"] = ShaderLanguage::TYPE_VEC3;
|
||||
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMALMAP_DEPTH"] = ShaderLanguage::TYPE_FLOAT;
|
||||
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMAL_MAP"] = ShaderLanguage::TYPE_VEC3;
|
||||
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMAL_MAP_DEPTH"] = ShaderLanguage::TYPE_FLOAT;
|
||||
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2);
|
||||
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["UV2"] = constt(ShaderLanguage::TYPE_VEC2);
|
||||
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
|
||||
|
@ -242,8 +242,8 @@ ShaderTypes::ShaderTypes() {
|
|||
shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["LIGHT_VERTEX"] = ShaderLanguage::TYPE_VEC3;
|
||||
shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["FRAGCOORD"] = constt(ShaderLanguage::TYPE_VEC4);
|
||||
shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
|
||||
shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMALMAP"] = ShaderLanguage::TYPE_VEC3;
|
||||
shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMALMAP_DEPTH"] = ShaderLanguage::TYPE_FLOAT;
|
||||
shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMAL_MAP"] = ShaderLanguage::TYPE_VEC3;
|
||||
shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMAL_MAP_DEPTH"] = ShaderLanguage::TYPE_FLOAT;
|
||||
shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2);
|
||||
shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
|
||||
shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
|
||||
|
|
Loading…
Reference in New Issue