Trying to add particles in 3d.
But particles can’t blend with each other.(depth test problem)
If i disabled depth test for particles. It blend with each other ok. But
have problems with other objects.
Any ideas, how to fix?
render script
function Render:render_3d()
if (not self.targets.light_map) then return end
local camera = CAMERAS.current
render.set_viewport(camera.viewport.x, camera.viewport.y, camera.viewport.width, camera.viewport.height)
render.set_view(camera:get_view())
render.set_projection(camera:get_proj())
render.enable_state(render.STATE_DEPTH_TEST)
render.set_depth_func(render.COMPARE_FUNC_LEQUAL)
render.enable_texture(1, self.targets.light_map, render.BUFFER_COLOR_BIT)
render.set_depth_mask(true)
--no transparent
render.draw(self.predicates.wall, self.constants_buffers.light_map)
render.enable_state(render.STATE_BLEND)
render.set_blend_func(render.BLEND_SRC_ALPHA, render.BLEND_ONE_MINUS_SRC_ALPHA)
render.disable_state(render.STATE_CULL_FACE)
--all objects with transparent. Walls,enemies,objects, particles.
render.draw(self.predicates.transparent3d, self.constants_buffers.light_map)
if CONSTANTS.DEBUG.draw_physics then render.draw(self.predicates.debug_physics) end
render.draw_debug3d()
render.disable_state(render.STATE_DEPTH_TEST)
render.enable_state(render.STATE_CULL_FACE)
render.set_depth_mask(false)
render.disable_texture(1)
end