Jump to content

[SOLVED] Sun with custom sky background


photo

Recommended Posts

I'm wondering is there a way to display custom background and a sun at the same time? My experiments shows that sun is disabled when 'Background' state is enabled for sky material.

  • Like 1
Link to comment

You could try to modifying core/shaders/default/skies/fragment_sphere_ambient.shader code to combine sun/sky scattering color with background cube texture cube based by mixing both componenten based on background texture alpha component (final color = (1 - background A) * scattering color + background A * background RGB)

Link to comment

You could try to modifying core/shaders/default/skies/fragment_sphere_ambient.shader code to combine sun/sky scattering color with background cube texture cube based by mixing both componenten based on background texture alpha component (final color = (1 - background A) * scattering color + background A * background RGB)

 

I already did it, more than a year ago, but I'm asking for a solution that does not require modification of core shaders cause those are sometimes changed without any update scripts, documentation or even changelog notices.

Link to comment
  • 2 weeks later...

Care to share the modified shader with us to speed it up? B)

 

That was not a modified scattering shader, but complete replacement for PS 2.0 hardware based on year 2009 shaders. It supports gradient background with clouds and own sun rendering in single ambient pass (meaning it looked great and was really cheap with scattering disabled). It can be easily modified to replace all gradient stuff with single texture fetch:

half3 back = texCUBE(s_texture_4,IN.texcoord_5).xyz;

 

p.s. world light direction should be also passed to that material.

d3d9.zip

Link to comment

Actually, that shader is of poor quality and does not use Scattering Sun color, size, etc. parameters. Think of it as a proof of concept that we can have cheap sun effect rendered in ambient pass over the sky dome.

Link to comment
  • 2 weeks later...

Are there any plans in the near future for providing a system for stars that works withing the existing environment / scattering system?

We looking into stars at the moment and any suggestions would be helpful.

Link to comment
  • 1 year later...

как сделать, чтобы солнце было видно вместе с skybox

 

how to make the sun visible with skybox

 

	<material name="example_sky_dome" parent="mesh_base">
		<options depth_mask="0" cast_shadow="0" receive_shadow="0" cast_world_shadow="0" receive_world_shadow="0" receive_translucent="0"/>
		<state name="volumetric">1</state>
		<state name="deferred">0</state>
		<state name="light_spot">0</state>
		<state name="light_omni">0</state>
		<state name="light_proj">0</state>
		<state name="light_world">0</state>
		<texture name="emission">textures/insert_your_sky_dome_here_d.dds</texture>
		<parameter name="environment_scale">0</parameter>
		<parameter name="emission_scale">1.1</parameter>
		<parameter name="glow_scale">1</parameter>
	</material>

Is this what you mean?

Link to comment

I see your problem, though I can't replicate problem here. My sun stays visible with the same settings.

 

We have used a different method for the skydome in the past - (it is surprising what unigine sneaks into the UI over the years - will try this method you use more - the double layering is nice effect)

 

The method we have used (and the one that goes with the material I suggested previously), is for a mesh hemisphere of a large radius - (It also works without a cubemap). I can see some benefits to method you use now.

 

Does the problem in your video happen if you swap the custom background texture for some default textures?

 

post-73-0-20494000-1375408547_thumb.jpg post-73-0-89411700-1375408561_thumb.jpg

Link to comment
×
×
  • Create New...