1067 lines
23 KiB
Plaintext
1067 lines
23 KiB
Plaintext
|
/*
|
|||
|
--------------------------------------------------------------------------------
|
|||
|
This source file is part of SkyX.
|
|||
|
Visit http://www.paradise-studios.net/products/skyx/
|
|||
|
|
|||
|
Copyright (C) 2009-2012 Xavier Vergu<67>n Gonz<6E>lez <xavyiy@gmail.com>
|
|||
|
|
|||
|
This program is free software; you can redistribute it and/or modify it under
|
|||
|
the terms of the GNU Lesser General Public License as published by the Free Software
|
|||
|
Foundation; either version 2 of the License, or (at your option) any later
|
|||
|
version.
|
|||
|
|
|||
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|||
|
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|||
|
|
|||
|
You should have received a copy of the GNU Lesser General Public License along with
|
|||
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|||
|
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
|||
|
http://www.gnu.org/copyleft/lesser.txt.
|
|||
|
--------------------------------------------------------------------------------
|
|||
|
*/
|
|||
|
|
|||
|
// ------------------------- SkyX clouds -----------------------------
|
|||
|
|
|||
|
vertex_program SkyX_Clouds_VP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Clouds.hlsl
|
|||
|
entry_point main_vp
|
|||
|
target vs_1_1
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named_auto uWorldViewProj worldviewproj_matrix
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
vertex_program SkyX_Clouds_VP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Clouds.vertex
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
vertex_program SkyX_Clouds_VP unified
|
|||
|
{
|
|||
|
delegate SkyX_Clouds_VP_GLSL
|
|||
|
delegate SkyX_Clouds_VP_HLSL
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Clouds_LDR_FP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Clouds.hlsl
|
|||
|
entry_point main_fp
|
|||
|
target ps_2_0
|
|||
|
preprocessor_defines LDR
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Clouds_LDR_FP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Clouds.fragment
|
|||
|
preprocessor_defines LDR
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Clouds_LDR_FP unified
|
|||
|
{
|
|||
|
delegate SkyX_Clouds_LDR_FP_GLSL
|
|||
|
delegate SkyX_Clouds_LDR_FP_HLSL
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Clouds_HDR_FP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Clouds.hlsl
|
|||
|
entry_point main_fp
|
|||
|
target ps_2_0
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Clouds_HDR_FP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Clouds.fragment
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Clouds_HDR_FP unified
|
|||
|
{
|
|||
|
delegate SkyX_Clouds_HDR_FP_GLSL
|
|||
|
delegate SkyX_Clouds_HDR_FP_HLSL
|
|||
|
}
|
|||
|
|
|||
|
// ------------------------- SkyX volumetric clouds ------------------
|
|||
|
|
|||
|
vertex_program SkyX_VolClouds_VP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_VolClouds.hlsl
|
|||
|
entry_point main_vp
|
|||
|
target vs_1_1
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named_auto uWorldViewProj worldviewproj_matrix
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
vertex_program SkyX_VolClouds_VP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_VolClouds.vertex
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
vertex_program SkyX_VolClouds_VP unified
|
|||
|
{
|
|||
|
delegate SkyX_VolClouds_VP_HLSL
|
|||
|
delegate SkyX_VolClouds_VP_GLSL
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_VolClouds_FP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_VolClouds.hlsl
|
|||
|
entry_point main_fp
|
|||
|
target ps_2_0
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_VolClouds_FP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_VolClouds.fragment
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named uDensity0 int 0
|
|||
|
param_named uDensity1 int 1
|
|||
|
param_named uNoise int 2
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_VolClouds_FP unified
|
|||
|
{
|
|||
|
delegate SkyX_VolClouds_FP_HLSL
|
|||
|
delegate SkyX_VolClouds_FP_GLSL
|
|||
|
}
|
|||
|
|
|||
|
material SkyX_VolClouds
|
|||
|
{
|
|||
|
receive_shadows off
|
|||
|
|
|||
|
technique
|
|||
|
{
|
|||
|
pass
|
|||
|
{
|
|||
|
lighting off
|
|||
|
|
|||
|
depth_write off
|
|||
|
depth_check on
|
|||
|
|
|||
|
cull_hardware none
|
|||
|
cull_software none
|
|||
|
|
|||
|
scene_blend alpha_blend
|
|||
|
alpha_rejection greater 0
|
|||
|
|
|||
|
vertex_program_ref SkyX_VolClouds_VP
|
|||
|
{
|
|||
|
param_named_auto uCameraPosition camera_position_object_space
|
|||
|
param_named uRadius float 30000
|
|||
|
}
|
|||
|
|
|||
|
fragment_program_ref SkyX_VolClouds_FP
|
|||
|
{
|
|||
|
param_named uInterpolation float 0
|
|||
|
param_named uSunDirection float3 0 1 0
|
|||
|
param_named uSunColor float3 1 1 1
|
|||
|
param_named uAmbientColor float3 0.63 0.63 0.7
|
|||
|
param_named uLightResponse float4 0.25 0.2 1 0.1
|
|||
|
param_named uAmbientFactors float4 0.45 0.3 0.6 1
|
|||
|
}
|
|||
|
|
|||
|
texture_unit Density0
|
|||
|
{
|
|||
|
tex_address_mode wrap
|
|||
|
tex_coord_set 0
|
|||
|
}
|
|||
|
|
|||
|
texture_unit Density1
|
|||
|
{
|
|||
|
tex_address_mode wrap
|
|||
|
tex_coord_set 1
|
|||
|
}
|
|||
|
|
|||
|
texture_unit Noise
|
|||
|
{
|
|||
|
tex_address_mode wrap
|
|||
|
tex_coord_set 2
|
|||
|
texture Noise.jpg
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// ---------------- SkyX volumetric clouds + lightning ------------------
|
|||
|
|
|||
|
vertex_program SkyX_VolClouds_Lightning_VP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_VolClouds_Lightning.hlsl
|
|||
|
entry_point main_vp
|
|||
|
target vs_1_1
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named_auto uWorldViewProj worldviewproj_matrix
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
vertex_program SkyX_VolClouds_Lightning_VP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_VolClouds_Lightning.vertex
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
vertex_program SkyX_VolClouds_Lightning_VP unified
|
|||
|
{
|
|||
|
delegate SkyX_VolClouds_Lightning_VP_HLSL
|
|||
|
delegate SkyX_VolClouds_Lightning_VP_GLSL
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_VolClouds_Lightning_FP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_VolClouds_Lightning.hlsl
|
|||
|
entry_point main_fp
|
|||
|
target ps_2_0
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_VolClouds_Lightning_FP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_VolClouds_Lightning.fragment
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named uDensity0 int 0
|
|||
|
param_named uDensity1 int 1
|
|||
|
param_named uNoise int 2
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_VolClouds_Lightning_FP unified
|
|||
|
{
|
|||
|
delegate SkyX_VolClouds_Lightning_FP_HLSL
|
|||
|
delegate SkyX_VolClouds_Lightning_FP_GLSL
|
|||
|
}
|
|||
|
|
|||
|
material SkyX_VolClouds_Lightning
|
|||
|
{
|
|||
|
receive_shadows off
|
|||
|
|
|||
|
technique
|
|||
|
{
|
|||
|
pass
|
|||
|
{
|
|||
|
lighting off
|
|||
|
|
|||
|
depth_write off
|
|||
|
depth_check on
|
|||
|
|
|||
|
cull_hardware none
|
|||
|
cull_software none
|
|||
|
|
|||
|
scene_blend alpha_blend
|
|||
|
alpha_rejection greater 0
|
|||
|
|
|||
|
vertex_program_ref SkyX_VolClouds_Lightning_VP
|
|||
|
{
|
|||
|
param_named_auto uCameraPosition camera_position_object_space
|
|||
|
param_named uRadius float 30000
|
|||
|
}
|
|||
|
|
|||
|
fragment_program_ref SkyX_VolClouds_Lightning_FP
|
|||
|
{
|
|||
|
param_named uInterpolation float 0
|
|||
|
param_named uSunDirection float3 0 1 0
|
|||
|
param_named uSunColor float3 1 1 1
|
|||
|
param_named uAmbientColor float3 0.63 0.63 0.7
|
|||
|
param_named uLightResponse float4 0.25 0.2 1 0.1
|
|||
|
param_named uAmbientFactors float4 0.45 0.3 0.6 1
|
|||
|
|
|||
|
param_named uLightning0 float4 0 0 0 0
|
|||
|
param_named uLightning1 float4 0 0 0 0
|
|||
|
param_named uLightning2 float4 0 0 0 0
|
|||
|
|
|||
|
param_named uLightningColor float3 1 1 1
|
|||
|
}
|
|||
|
|
|||
|
texture_unit Density0
|
|||
|
{
|
|||
|
tex_address_mode wrap
|
|||
|
tex_coord_set 0
|
|||
|
}
|
|||
|
|
|||
|
texture_unit Density1
|
|||
|
{
|
|||
|
tex_address_mode wrap
|
|||
|
tex_coord_set 1
|
|||
|
}
|
|||
|
|
|||
|
texture_unit Noise
|
|||
|
{
|
|||
|
tex_address_mode wrap
|
|||
|
tex_coord_set 2
|
|||
|
texture Noise.jpg
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// --------------------- SkyX skydome material ------------------------
|
|||
|
|
|||
|
vertex_program SkyX_Skydome_VP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Skydome.hlsl
|
|||
|
entry_point main_vp
|
|||
|
target vs_2_0
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named_auto uWorldViewProj worldviewproj_matrix
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
vertex_program SkyX_Skydome_VP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Skydome.vertex
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
vertex_program SkyX_Skydome_VP unified
|
|||
|
{
|
|||
|
delegate SkyX_Skydome_VP_HLSL
|
|||
|
delegate SkyX_Skydome_VP_GLSL
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Skydome_STARFIELD_LDR_FP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Skydome.hlsl
|
|||
|
entry_point main_fp
|
|||
|
target ps_2_0
|
|||
|
preprocessor_defines LDR,STARFIELD
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Skydome_STARFIELD_LDR_FP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Skydome.fragment
|
|||
|
preprocessor_defines LDR=1;STARFIELD=1
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Skydome_STARFIELD_LDR_FP unified
|
|||
|
{
|
|||
|
delegate SkyX_Skydome_STARFIELD_LDR_FP_HLSL
|
|||
|
delegate SkyX_Skydome_STARFIELD_LDR_FP_GLSL
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Skydome_STARFIELD_HDR_FP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Skydome.hlsl
|
|||
|
entry_point main_fp
|
|||
|
target ps_2_0
|
|||
|
preprocessor_defines STARFIELD
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Skydome_STARFIELD_HDR_FP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Skydome.fragment
|
|||
|
preprocessor_defines STARFIELD=1
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Skydome_STARFIELD_HDR_FP unified
|
|||
|
{
|
|||
|
delegate SkyX_Skydome_STARFIELD_HDR_FP_HLSL
|
|||
|
delegate SkyX_Skydome_STARFIELD_HDR_FP_GLSL
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Skydome_LDR_FP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Skydome.hlsl
|
|||
|
entry_point main_fp
|
|||
|
target ps_2_0
|
|||
|
preprocessor_defines LDR
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Skydome_LDR_FP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Skydome.fragment
|
|||
|
preprocessor_defines LDR=1
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Skydome_LDR_FP unified
|
|||
|
{
|
|||
|
delegate SkyX_Skydome_LDR_FP_HLSL
|
|||
|
delegate SkyX_Skydome_LDR_FP_GLSL
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Skydome_HDR_FP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Skydome.hlsl
|
|||
|
entry_point main_fp
|
|||
|
target ps_2_0
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Skydome_HDR_FP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Skydome.fragment
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Skydome_HDR_FP unified
|
|||
|
{
|
|||
|
delegate SkyX_Skydome_HDR_FP_HLSL
|
|||
|
delegate SkyX_Skydome_HDR_FP_GLSL
|
|||
|
}
|
|||
|
|
|||
|
material SkyX_Skydome_STARFIELD_LDR
|
|||
|
{
|
|||
|
receive_shadows off
|
|||
|
|
|||
|
technique
|
|||
|
{
|
|||
|
pass
|
|||
|
{
|
|||
|
lighting off
|
|||
|
|
|||
|
depth_write off
|
|||
|
depth_check off
|
|||
|
|
|||
|
cull_hardware none
|
|||
|
cull_software none
|
|||
|
|
|||
|
scene_blend alpha_blend
|
|||
|
|
|||
|
vertex_program_ref SkyX_Skydome_VP
|
|||
|
{
|
|||
|
// Must be the same as in the fragment program, normalized
|
|||
|
param_named uLightDir float3 0 0 1
|
|||
|
// Camera position
|
|||
|
param_named uCameraPos float3 0 1.0001 0
|
|||
|
|
|||
|
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
|
|||
|
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
|
|||
|
|
|||
|
// Inner radius
|
|||
|
param_named uInnerRadius float 1
|
|||
|
|
|||
|
param_named uKrESun float 0.32299994
|
|||
|
param_named uKmESun float 0.350000002
|
|||
|
param_named uKr4PI float 0.0850
|
|||
|
param_named uKm4PI float 0.2008849557
|
|||
|
|
|||
|
// 1 / (OuterRadius-InnerRadius)
|
|||
|
param_named uScale float 4
|
|||
|
// (OuterRadius - InnerRadius) / 2.0f
|
|||
|
param_named uScaleDepth float 0.125
|
|||
|
// Scale / ScaleDepth;
|
|||
|
param_named uScaleOverScaleDepth float 32
|
|||
|
|
|||
|
param_named uNumberOfSamples int 6
|
|||
|
param_named uSamples float 6
|
|||
|
}
|
|||
|
|
|||
|
fragment_program_ref SkyX_Skydome_STARFIELD_LDR_FP
|
|||
|
{
|
|||
|
param_named uTime float 0
|
|||
|
// Must be the same as in the vertex program, normalized
|
|||
|
param_named uLightDir float3 0 0 1
|
|||
|
param_named uG float -0.991
|
|||
|
param_named uG2 float 0.982081
|
|||
|
param_named uExposure float 1.75
|
|||
|
}
|
|||
|
|
|||
|
texture_unit Starfield
|
|||
|
{
|
|||
|
texture SkyX_Starfield.png
|
|||
|
tex_address_mode wrap
|
|||
|
filtering linear linear none
|
|||
|
tex_coord_set 0
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
material SkyX_Skydome_STARFIELD_HDR
|
|||
|
{
|
|||
|
receive_shadows off
|
|||
|
|
|||
|
technique
|
|||
|
{
|
|||
|
pass
|
|||
|
{
|
|||
|
lighting off
|
|||
|
|
|||
|
depth_write off
|
|||
|
depth_check off
|
|||
|
|
|||
|
cull_hardware none
|
|||
|
cull_software none
|
|||
|
|
|||
|
scene_blend alpha_blend
|
|||
|
|
|||
|
vertex_program_ref SkyX_Skydome_VP
|
|||
|
{
|
|||
|
// Must be the same as in the fragment program, normalized
|
|||
|
param_named uLightDir float3 0 0 1
|
|||
|
// Camera position
|
|||
|
param_named uCameraPos float3 0 1.0001 0
|
|||
|
|
|||
|
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
|
|||
|
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
|
|||
|
|
|||
|
// Inner radius
|
|||
|
param_named uInnerRadius float 1
|
|||
|
|
|||
|
param_named uKrESun float 0.32299994
|
|||
|
param_named uKmESun float 0.350000002
|
|||
|
param_named uKr4PI float 0.0850
|
|||
|
param_named uKm4PI float 0.2008849557
|
|||
|
|
|||
|
// 1 / (OuterRadius-InnerRadius)
|
|||
|
param_named uScale float 4
|
|||
|
// (OuterRadius - InnerRadius) / 2.0f
|
|||
|
param_named uScaleDepth float 0.125
|
|||
|
// Scale / ScaleDepth;
|
|||
|
param_named uScaleOverScaleDepth float 32
|
|||
|
|
|||
|
param_named uNumberOfSamples int 6
|
|||
|
param_named uSamples float 6
|
|||
|
}
|
|||
|
|
|||
|
fragment_program_ref SkyX_Skydome_STARFIELD_HDR_FP
|
|||
|
{
|
|||
|
param_named uTime float 0
|
|||
|
// Must be the same as in the vertex program, normalized
|
|||
|
param_named uLightDir float3 0 0 1
|
|||
|
param_named uG float -0.991
|
|||
|
param_named uG2 float 0.982081
|
|||
|
param_named uExposure float 1
|
|||
|
}
|
|||
|
|
|||
|
texture_unit Starfield
|
|||
|
{
|
|||
|
texture SkyX_Starfield.png gamma
|
|||
|
tex_address_mode wrap
|
|||
|
filtering linear linear none
|
|||
|
tex_coord_set 0
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
material SkyX_Skydome_LDR
|
|||
|
{
|
|||
|
receive_shadows off
|
|||
|
|
|||
|
technique
|
|||
|
{
|
|||
|
pass
|
|||
|
{
|
|||
|
lighting off
|
|||
|
|
|||
|
depth_write off
|
|||
|
depth_check off
|
|||
|
|
|||
|
cull_hardware none
|
|||
|
cull_software none
|
|||
|
|
|||
|
scene_blend alpha_blend
|
|||
|
|
|||
|
vertex_program_ref SkyX_Skydome_VP
|
|||
|
{
|
|||
|
// Must be the same as in the fragment program, normalized
|
|||
|
param_named uLightDir float3 0 0 1
|
|||
|
// Camera position
|
|||
|
param_named uCameraPos float3 0 1.0001 0
|
|||
|
|
|||
|
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
|
|||
|
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
|
|||
|
|
|||
|
// Inner radius
|
|||
|
param_named uInnerRadius float 1
|
|||
|
|
|||
|
param_named uKrESun float 0.32299994
|
|||
|
param_named uKmESun float 0.350000002
|
|||
|
param_named uKr4PI float 0.0850
|
|||
|
param_named uKm4PI float 0.2008849557
|
|||
|
|
|||
|
// 1 / (OuterRadius-InnerRadius)
|
|||
|
param_named uScale float 4
|
|||
|
// (OuterRadius - InnerRadius) / 2.0f
|
|||
|
param_named uScaleDepth float 0.125
|
|||
|
// Scale / ScaleDepth;
|
|||
|
param_named uScaleOverScaleDepth float 32
|
|||
|
|
|||
|
param_named uNumberOfSamples int 6
|
|||
|
param_named uSamples float 6
|
|||
|
}
|
|||
|
|
|||
|
fragment_program_ref SkyX_Skydome_LDR_FP
|
|||
|
{
|
|||
|
// Must be the same as in the vertex program, normalized
|
|||
|
param_named uLightDir float3 0 0 1
|
|||
|
param_named uG float -0.991
|
|||
|
param_named uG2 float 0.982081
|
|||
|
param_named uExposure float 1.75
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
material SkyX_Skydome_HDR
|
|||
|
{
|
|||
|
receive_shadows off
|
|||
|
|
|||
|
technique
|
|||
|
{
|
|||
|
pass
|
|||
|
{
|
|||
|
lighting off
|
|||
|
|
|||
|
depth_write off
|
|||
|
depth_check off
|
|||
|
|
|||
|
cull_hardware none
|
|||
|
cull_software none
|
|||
|
|
|||
|
scene_blend alpha_blend
|
|||
|
|
|||
|
vertex_program_ref SkyX_Skydome_VP
|
|||
|
{
|
|||
|
// Must be the same as in the fragment program, normalized
|
|||
|
param_named uLightDir float3 0 0 1
|
|||
|
// Camera position
|
|||
|
param_named uCameraPos float3 0 1.0001 0
|
|||
|
|
|||
|
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
|
|||
|
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
|
|||
|
|
|||
|
// Inner radius
|
|||
|
param_named uInnerRadius float 1
|
|||
|
|
|||
|
param_named uKrESun float 0.32299994
|
|||
|
param_named uKmESun float 0.350000002
|
|||
|
param_named uKr4PI float 0.0850
|
|||
|
param_named uKm4PI float 0.2008849557
|
|||
|
|
|||
|
// 1 / (OuterRadius-InnerRadius)
|
|||
|
param_named uScale float 4
|
|||
|
// (OuterRadius - InnerRadius) / 2.0f
|
|||
|
param_named uScaleDepth float 0.125
|
|||
|
// Scale / ScaleDepth;
|
|||
|
param_named uScaleOverScaleDepth float 32
|
|||
|
|
|||
|
param_named uNumberOfSamples int 6
|
|||
|
param_named uSamples float 6
|
|||
|
}
|
|||
|
|
|||
|
fragment_program_ref SkyX_Skydome_HDR_FP
|
|||
|
{
|
|||
|
// Must be the same as in the vertex program, normalized
|
|||
|
param_named uLightDir float3 0 0 1
|
|||
|
param_named uG float -0.991
|
|||
|
param_named uG2 float 0.982081
|
|||
|
param_named uExposure float 1
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// --------------------- SkyX moon material ------------------------
|
|||
|
|
|||
|
vertex_program SkyX_Moon_VP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Moon.hlsl
|
|||
|
entry_point main_vp
|
|||
|
target vs_1_1
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named_auto uWorldViewProj worldviewproj_matrix
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
vertex_program SkyX_Moon_VP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Moon.vertex
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
vertex_program SkyX_Moon_VP unified
|
|||
|
{
|
|||
|
delegate SkyX_Moon_VP_GLSL
|
|||
|
delegate SkyX_Moon_VP_HLSL
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Moon_FP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Moon.hlsl
|
|||
|
entry_point main_fp
|
|||
|
target ps_2_0
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Moon_FP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Moon.fragment
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named uMoon int 0
|
|||
|
param_named uMoonHalo int 1
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Moon_FP unified
|
|||
|
{
|
|||
|
delegate SkyX_Moon_FP_GLSL
|
|||
|
delegate SkyX_Moon_FP_HLSL
|
|||
|
}
|
|||
|
|
|||
|
material SkyX_Moon
|
|||
|
{
|
|||
|
receive_shadows off
|
|||
|
|
|||
|
technique
|
|||
|
{
|
|||
|
pass
|
|||
|
{
|
|||
|
lighting off
|
|||
|
|
|||
|
depth_write off
|
|||
|
depth_check off
|
|||
|
|
|||
|
scene_blend alpha_blend
|
|||
|
|
|||
|
vertex_program_ref SkyX_Moon_VP
|
|||
|
{
|
|||
|
param_named_auto uWorld world_matrix
|
|||
|
param_named uSkydomeCenter float3 0 0 0
|
|||
|
}
|
|||
|
|
|||
|
fragment_program_ref SkyX_Moon_FP
|
|||
|
{
|
|||
|
param_named uMoonPhase float3 0.25 0.6 1
|
|||
|
param_named uMoonHalo1 float3 0.25 0.5 1
|
|||
|
param_named uMoonHalo2 float3 0 0 0
|
|||
|
param_named uMoonHaloFlip float 0
|
|||
|
}
|
|||
|
|
|||
|
texture_unit Moon
|
|||
|
{
|
|||
|
texture SkyX_Moon.png
|
|||
|
tex_coord_set 0
|
|||
|
tex_address_mode clamp
|
|||
|
}
|
|||
|
|
|||
|
texture_unit MoonHalo
|
|||
|
{
|
|||
|
texture SkyX_MoonHalo.png
|
|||
|
tex_coord_set 1
|
|||
|
tex_address_mode clamp
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// --------------------- SkyX lightning material ------------------------
|
|||
|
|
|||
|
vertex_program SkyX_Lightning_VP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Lightning.hlsl
|
|||
|
entry_point main_vp
|
|||
|
target vs_1_1
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named_auto uWorldViewProj worldviewproj_matrix
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
vertex_program SkyX_Lightning_VP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Lightning.vertex
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
vertex_program SkyX_Lightning_VP unified
|
|||
|
{
|
|||
|
delegate SkyX_Lightning_VP_GLSL
|
|||
|
delegate SkyX_Lightning_VP_HLSL
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Lightning_FP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Lightning.hlsl
|
|||
|
entry_point main_fp
|
|||
|
target ps_2_0
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Lightning_FP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Lightning.fragment
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Lightning_FP unified
|
|||
|
{
|
|||
|
delegate SkyX_Lightning_FP_GLSL
|
|||
|
delegate SkyX_Lightning_FP_HLSL
|
|||
|
}
|
|||
|
|
|||
|
material SkyX_Lightning
|
|||
|
{
|
|||
|
receive_shadows off
|
|||
|
|
|||
|
technique
|
|||
|
{
|
|||
|
pass
|
|||
|
{
|
|||
|
lighting off
|
|||
|
|
|||
|
scene_blend add
|
|||
|
scene_blend_op max
|
|||
|
|
|||
|
depth_write on
|
|||
|
depth_check off
|
|||
|
|
|||
|
vertex_program_ref SkyX_Lightning_VP
|
|||
|
{
|
|||
|
param_named_auto uData custom 0
|
|||
|
}
|
|||
|
|
|||
|
fragment_program_ref SkyX_Lightning_FP
|
|||
|
{
|
|||
|
param_named uColor float3 1 1 1
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// --------------------- SkyX ground material ------------------------
|
|||
|
|
|||
|
vertex_program SkyX_Ground_VP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Ground.hlsl
|
|||
|
entry_point main_vp
|
|||
|
target vs_2_0
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named_auto uWorldViewProj worldviewproj_matrix
|
|||
|
param_named_auto uWorld world_matrix
|
|||
|
param_named_auto uCameraPos_ camera_position
|
|||
|
|
|||
|
// Must be the same as in the fragment program, normalized
|
|||
|
param_named uLightDir float3 1 0 0
|
|||
|
// Camera position
|
|||
|
param_named uCameraPos float3 0 1.0001 0
|
|||
|
|
|||
|
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
|
|||
|
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
|
|||
|
|
|||
|
// Inner radius
|
|||
|
param_named uInnerRadius float 1
|
|||
|
|
|||
|
param_named uKrESun float 0.32299994
|
|||
|
param_named uKr4PI float 0.0850
|
|||
|
param_named uKm4PI float 0.2008849557
|
|||
|
|
|||
|
// 1 / (OuterRadius-InnerRadius)
|
|||
|
param_named uScale float 4
|
|||
|
// (OuterRadius - InnerRadius) / 2.0f
|
|||
|
param_named uScaleDepth float 0.125
|
|||
|
// Scale / ScaleDepth;
|
|||
|
param_named uScaleOverScaleDepth float 32
|
|||
|
param_named uSkydomeRadius float 2850
|
|||
|
|
|||
|
param_named uNumberOfSamples int 6
|
|||
|
param_named uSamples float 6
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
vertex_program SkyX_Ground_VP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Ground.vertex
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named_auto uWorld world_matrix
|
|||
|
param_named_auto uCameraPos_ camera_position
|
|||
|
|
|||
|
// Must be the same as in the fragment program, normalized
|
|||
|
param_named uLightDir float3 1 0 0
|
|||
|
// Camera position
|
|||
|
param_named uCameraPos float3 0 1.0001 0
|
|||
|
|
|||
|
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
|
|||
|
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
|
|||
|
|
|||
|
// Inner radius
|
|||
|
param_named uInnerRadius float 1
|
|||
|
|
|||
|
param_named uKrESun float 0.32299994
|
|||
|
param_named uKr4PI float 0.0850
|
|||
|
param_named uKm4PI float 0.2008849557
|
|||
|
|
|||
|
// 1 / (OuterRadius-InnerRadius)
|
|||
|
param_named uScale float 4
|
|||
|
// (OuterRadius - InnerRadius) / 2.0f
|
|||
|
param_named uScaleDepth float 0.125
|
|||
|
// Scale / ScaleDepth;
|
|||
|
param_named uScaleOverScaleDepth float 32
|
|||
|
param_named uSkydomeRadius float 2850
|
|||
|
|
|||
|
param_named uNumberOfSamples int 6
|
|||
|
param_named uSamples float 6
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
vertex_program SkyX_Ground_VP unified
|
|||
|
{
|
|||
|
delegate SkyX_Ground_VP_GLSL
|
|||
|
delegate SkyX_Ground_VP_HLSL
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Ground_LDR_FP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Ground.hlsl
|
|||
|
entry_point main_fp
|
|||
|
target ps_2_0
|
|||
|
preprocessor_defines LDR
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named uExposure float 1.75
|
|||
|
|
|||
|
param_named uLightDir float3 0 0 1
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Ground_LDR_FP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Ground.fragment
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named uExposure float 1.75
|
|||
|
|
|||
|
param_named uLightDir float3 0 0 1
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Ground_LDR_FP unified
|
|||
|
{
|
|||
|
delegate SkyX_Ground_LDR_FP_GLSL
|
|||
|
delegate SkyX_Ground_LDR_FP_HLSL
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Ground_HDR_FP_HLSL hlsl
|
|||
|
{
|
|||
|
source SkyX_Ground.hlsl
|
|||
|
entry_point main_fp
|
|||
|
target ps_2_0
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named uLightDir float3 0 0 1
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Ground_HDR_FP_GLSL glsl
|
|||
|
{
|
|||
|
source SkyX_Ground.fragment
|
|||
|
|
|||
|
default_params
|
|||
|
{
|
|||
|
param_named uLightDir float3 0 0 1
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
fragment_program SkyX_Ground_HDR_FP unified
|
|||
|
{
|
|||
|
delegate SkyX_Ground_HDR_FP_GLSL
|
|||
|
delegate SkyX_Ground_HDR_FP_HLSL
|
|||
|
}
|