- The lower threshold of the HDR glow. When using the GLES2 renderer (which doesn't support HDR), this needs to be below [code]1.0[/code] for glow to be visible. A value of [code]0.9[/code] works well in this case.
+ The lower threshold of the HDR glow. When using the OpenGL renderer (which doesn't support HDR), this needs to be below [code]1.0[/code] for glow to be visible. A value of [code]0.9[/code] works well in this case.
- The overall brightness multiplier of the glow effect. When using the GLES2 renderer, this should be increased to 1.5 to compensate for the lack of HDR rendering.
+ The overall brightness multiplier of the glow effect. When using the OpenGL renderer, this should be increased to 1.5 to compensate for the lack of HDR rendering.
- The strength of the glow effect. This applies as the glow is blurred across the screen and increases the distance and intensity of the blur. When using the GLES2 renderer, this should be increased to 1.3 to compensate for the lack of HDR rendering.
+ The strength of the glow effect. This applies as the glow is blurred across the screen and increases the distance and intensity of the blur. When using the OpenGL renderer, this should be increased to 1.3 to compensate for the lack of HDR rendering.
Repeats the center texture across the NinePatchRect. This won't cause any visible distortion. The texture must be seamless for this to work without displaying artifacts between edges.
Repeats the center texture across the NinePatchRect. This won't cause any visible distortion. The texture must be seamless for this to work without displaying artifacts between edges.
- [b]Note:[/b] Only supported when using the GLES3 renderer. When using the GLES2 renderer, this will behave like [constant AXIS_STRETCH_MODE_STRETCH].
+ [b]Note:[/b] Only supported when using the Vulkan renderer. When using the OpenGL renderer, this will behave like [constant AXIS_STRETCH_MODE_STRETCH].
Repeats the center texture across the NinePatchRect, but will also stretch the texture to make sure each tile is visible in full. This may cause the texture to be distorted, but less than [constant AXIS_STRETCH_MODE_STRETCH]. The texture must be seamless for this to work without displaying artifacts between edges.
Repeats the center texture across the NinePatchRect, but will also stretch the texture to make sure each tile is visible in full. This may cause the texture to be distorted, but less than [constant AXIS_STRETCH_MODE_STRETCH]. The texture must be seamless for this to work without displaying artifacts between edges.
- [b]Note:[/b] Only supported when using the GLES3 renderer. When using the GLES2 renderer, this will behave like [constant AXIS_STRETCH_MODE_STRETCH].
+ [b]Note:[/b] Only supported when using the Vulkan renderer. When using the OpenGL renderer, this will behave like [constant AXIS_STRETCH_MODE_STRETCH].
-bool RasterizerSceneGLES2::_shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas, int *p_in_quadrants, int p_quadrant_count, int p_current_subdiv, uint64_t p_tick, int &r_quadrant, int &r_shadow) {
- for (int i = p_quadrant_count - 1; i >= 0; i--) {
- int qidx = p_in_quadrants[i];
-
- if (shadow_atlas->quadrants[qidx].subdivision == (uint32_t)p_current_subdiv) {
- return false;
- }
-
- // look for an empty space
-
- int sc = shadow_atlas->quadrants[qidx].shadows.size();
- //condition to enable vertex lighting on this object
- bool vertex_lit = (material->shader->spatial.uses_vertex_lighting || storage->config.force_vertex_shading) && ((!unshaded && light) || using_fog); //fog forces vertex lighting because it still applies even if unshaded or no fog
-class RasterizerSceneGLES2 : public RasterizerScene {
-public:
- enum ShadowFilterMode {
- SHADOW_FILTER_NEAREST,
- SHADOW_FILTER_PCF5,
- SHADOW_FILTER_PCF13,
- };
-
- enum {
- INSTANCE_ATTRIB_BASE = 8,
- INSTANCE_BONE_BASE = 13,
- };
-
- ShadowFilterMode shadow_filter_mode;
-
- RID default_material;
- RID default_material_twosided;
- RID default_shader;
- RID default_shader_twosided;
-
- RID default_worldcoord_material;
- RID default_worldcoord_material_twosided;
- RID default_worldcoord_shader;
- RID default_worldcoord_shader_twosided;
-
- RID default_overdraw_material;
- RID default_overdraw_shader;
-
- uint64_t render_pass;
- uint64_t scene_pass;
- uint32_t current_material_index;
- uint32_t current_geometry_index;
- uint32_t current_light_index;
- uint32_t current_refprobe_index;
- uint32_t current_shader_index;
-
- RasterizerStorageGLES2 *storage;
- struct State {
- bool texscreen_copied;
- int current_blend_mode;
- float current_line_width;
- int current_depth_draw;
- bool current_depth_test;
- GLuint current_main_tex;
-
- SceneShaderGLES2 scene_shader;
- CubeToDpShaderGLES2 cube_to_dp_shader;
- TonemapShaderGLES2 tonemap_shader;
- EffectBlurShaderGLES2 effect_blur_shader;
-
- GLuint sky_verts;
-
- GLuint immediate_buffer;
- Color default_ambient;
- Color default_bg;
-
- // ResolveShaderGLES3 resolve_shader;
- // ScreenSpaceReflectionShaderGLES3 ssr_shader;
- // EffectBlurShaderGLES3 effect_blur_shader;
- // SubsurfScatteringShaderGLES3 sss_shader;
- // SsaoMinifyShaderGLES3 ssao_minify_shader;
- // SsaoShaderGLES3 ssao_shader;
- // SsaoBlurShaderGLES3 ssao_blur_shader;
- // ExposureShaderGLES3 exposure_shader;
-
- /*
- struct SceneDataUBO {
- //this is a std140 compatible struct. Please read the OpenGL 3.3 Specificaiton spec before doing any changes
- float projection_matrix[16];
- float inv_projection_matrix[16];
- float camera_inverse_matrix[16];
- float camera_matrix[16];
- float ambient_light_color[4];
- float bg_color[4];
- float fog_color_enabled[4];
- float fog_sun_color_amount[4];
-
- float ambient_energy;
- float bg_energy;
- float z_offset;
- float z_slope_scale;
- float shadow_dual_paraboloid_render_zfar;
- float shadow_dual_paraboloid_render_side;
- float viewport_size[2];
- float screen_pixel_size[2];
- float shadow_atlas_pixel_size[2];
- float shadow_directional_pixel_size[2];
-
- float time;
- float z_far;
- float reflection_multiplier;
- float subsurface_scatter_width;
- float ambient_occlusion_affect_light;
-
- uint32_t fog_depth_enabled;
- float fog_depth_begin;
- float fog_depth_curve;
- uint32_t fog_transmit_enabled;
- float fog_transmit_curve;
- uint32_t fog_height_enabled;
- float fog_height_min;
- float fog_height_max;
- float fog_height_curve;
- // make sure this struct is padded to be a multiple of 16 bytes for webgl
-
- } ubo_data;
-
- GLuint scene_ubo;
-
- struct EnvironmentRadianceUBO {
- float transform[16];
- float ambient_contribution;
- uint8_t padding[12];
-
- } env_radiance_data;
-
- GLuint env_radiance_ubo;
-
- GLuint sky_array;
-
- GLuint directional_ubo;
-
- GLuint spot_array_ubo;
- GLuint omni_array_ubo;
- GLuint reflection_array_ubo;
-
- GLuint immediate_buffer;
- GLuint immediate_array;
-
- uint32_t ubo_light_size;
- uint8_t *spot_array_tmp;
- uint8_t *omni_array_tmp;
- uint8_t *reflection_array_tmp;
-
- int max_ubo_lights;
- int max_forward_lights_per_object;
- int max_ubo_reflections;
- int max_skeleton_bones;
-
- bool used_contact_shadows;
-
- int spot_light_count;
- int omni_light_count;
- int directional_light_count;
- int reflection_probe_count;
-
- bool used_sss;
- bool using_contact_shadows;
-
- VS::ViewportDebugDraw debug_draw;
- */
-
- bool cull_front;
- bool cull_disabled;
-
- bool used_screen_texture;
- bool shadow_is_dual_parabolloid;
- float dual_parbolloid_direction;
- float dual_parbolloid_zfar;
-
- bool render_no_shadows;
-
- Vector2 viewport_size;
-
- Vector2 screen_pixel_size;
- } state;
-
- /* SHADOW ATLAS API */
-
- uint64_t shadow_atlas_realloc_tolerance_msec;
-
- struct ShadowAtlas : public RID_Data {
- enum {
- QUADRANT_SHIFT = 27,
- SHADOW_INDEX_MASK = (1 << QUADRANT_SHIFT) - 1,
- SHADOW_INVALID = 0xFFFFFFFF,
- };
-
- struct Quadrant {
- uint32_t subdivision;
-
- struct Shadow {
- RID owner;
- uint64_t version;
- uint64_t alloc_tick;
-
- Shadow() {
- version = 0;
- alloc_tick = 0;
- }
- };
-
- Vector<Shadow> shadows;
-
- Quadrant() {
- subdivision = 0;
- }
- } quadrants[4];
-
- int size_order[4];
- uint32_t smallest_subdiv;
-
- int size;
-
- GLuint fbo;
- GLuint depth;
- GLuint color;
-
- Map<RID, uint32_t> shadow_owners;
- };
-
- struct ShadowCubeMap {
- GLuint fbo[6];
- GLuint cubemap;
- uint32_t size;
- };
-
- Vector<ShadowCubeMap> shadow_cubemaps;
-
- RID_Owner<ShadowAtlas> shadow_atlas_owner;
-
- RID shadow_atlas_create();
- void shadow_atlas_set_size(RID p_atlas, int p_size);
- void shadow_atlas_set_quadrant_subdivision(RID p_atlas, int p_quadrant, int p_subdivision);
- bool _shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas, int *p_in_quadrants, int p_quadrant_count, int p_current_subdiv, uint64_t p_tick, int &r_quadrant, int &r_shadow);
- virtual void texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, int p_layer = 0);
- //virtual Ref<Image> texture_get_data(RID p_texture, int p_layer = 0) const;
- void buffer_orphan_and_upload(unsigned int p_buffer_size, unsigned int p_offset, unsigned int p_data_size, const void *p_data, GLenum p_target = GL_ARRAY_BUFFER, GLenum p_usage = GL_DYNAMIC_DRAW, bool p_optional_orphan = false) const;
- bool safe_buffer_sub_data(unsigned int p_total_buffer_size, GLenum p_target, unsigned int p_offset, unsigned int p_data_size, const void *p_data, unsigned int &r_offset_after) const;
- uint d = texelFetch(source_depth_mipmaps, mipP, mipLevel - 1).r;
- P.z = -(float(d) / 65535.0) * camera_z_far;
- }
-
- // Offset to pixel center
- P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z);
-
- return P;
-}
-
-/** Compute the occlusion due to sample with index \a i about the pixel at \a ssC that corresponds
- to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius
-
- Note that units of H() in the HPG12 paper are meters, not
- unitless. The whole falloff/sampling function is therefore
- unitless. In this implementation, we factor out (9 / radius).
-
- Four versions of the falloff function are implemented below
-*/
-float sampleAO(in ivec2 ssC, in vec3 C, in vec3 n_C, in float ssDiskRadius, in float p_radius, in int tapIndex, in float randomPatternRotationAngle) {
- void texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, int p_level) override {
+ void texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, int p_layer = 0);
+ //Ref<Image> texture_get_data(RID p_texture, int p_layer = 0) const;
+ void buffer_orphan_and_upload(unsigned int p_buffer_size, unsigned int p_offset, unsigned int p_data_size, const void *p_data, GLenum p_target = GL_ARRAY_BUFFER, GLenum p_usage = GL_DYNAMIC_DRAW, bool p_optional_orphan = false) const;
+ bool safe_buffer_sub_data(unsigned int p_total_buffer_size, GLenum p_target, unsigned int p_offset, unsigned int p_data_size, const void *p_data, unsigned int &r_offset_after) const;
if (RenderingServer::get_singleton()->is_low_end()) {
if (RenderingServer::get_singleton()->is_low_end()) {
- warnings.push_back(TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles2D\" option for this purpose."));
+ warnings.push_back(TTR("GPU-based particles are not supported by the OpenGL video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles2D\" option for this purpose."));
if (RenderingServer::get_singleton()->is_low_end()) {
if (RenderingServer::get_singleton()->is_low_end()) {
- warnings.push_back(TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles3D node instead. You can use the \"Convert to CPUParticles3D\" option for this purpose."));
+ warnings.push_back(TTR("GPU-based particles are not supported by the OpenGL video driver.\nUse the CPUParticles3D node instead. You can use the \"Convert to CPUParticles3D\" option for this purpose."));