Environemental Data

Everything about mods can be found here.

Moderator: Morax

Environemental Data

Postby Franck » 08 Mar 2016, 10:09

Hi all,

I wanna know if we can control on the supcom engine somme environemental data such as sun light power and rotation, wind, global frog... ?

I'm currently adding some lights on units and building, and i think it may be much more visually attractive with lower powered sun light.

Any idea ?
Franck
Crusader
 
Posts: 28
Joined: 24 Dec 2015, 16:16
Has liked: 1 time
Been liked: 1 time
FAF User Name: Franck

Re: Environemental Data

Postby nine2 » 08 Mar 2016, 12:51

That stuff is in the map file. Edit it in the map editor
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Environemental Data

Postby speed2 » 08 Mar 2016, 12:57

Well you can set a lot of things about lighting when creating a map.
User avatar
speed2
Contributor
 
Posts: 3189
Joined: 05 Jan 2013, 15:11
Has liked: 636 times
Been liked: 1119 times
FAF User Name: speed2

Re: Environemental Data

Postby Franck » 08 Mar 2016, 13:07

Wonferfull, i will take a deep look !
Franck
Crusader
 
Posts: 28
Joined: 24 Dec 2015, 16:16
Has liked: 1 time
Been liked: 1 time
FAF User Name: Franck

Re: Environemental Data

Postby Franck » 09 Mar 2016, 11:05

Ok cool, it's working :

A big amount a fog of war in a low powered sun with a bubble shader effect around the ACU :

http://hpics.li/104ce99

But sadly lights from shaders around the ACU do not reflect around in the environnement. So we cannot create artificials lightning for better visual... hum just light can change everything as i do in this simple speed test under Unreal Engine 4 :

http://hpics.li/3bd2390
Franck
Crusader
 
Posts: 28
Joined: 24 Dec 2015, 16:16
Has liked: 1 time
Been liked: 1 time
FAF User Name: Franck

Re: Environemental Data

Postby Lionhardt » 10 Mar 2016, 19:14

Night or dark light setting in general do not really work in supcom. Somehow units always have the same amount of brightens regardless of the environment brightness, I think. Night maps with light sources on the units would be cool though. But I really think this doesn't work. All the light effects in-game seem to be just semi transparent sprites or something.
Help me make better maps for all of us, visit my Mapping Thread.

Maps needing gameplay feedback:
Spoiler: show
[list updated last: 31.1.2018]

(maps available in the vault)

- Hexagonian Drylands
- Fervent Soil and Torrid Suns

YouTube Channel
User avatar
Lionhardt
Contributor
 
Posts: 1070
Joined: 29 Jan 2013, 23:44
Has liked: 188 times
Been liked: 144 times
FAF User Name: Lionhardt

Re: Environemental Data

Postby Franck » 10 Mar 2016, 21:47

I wonder myself if it can be coded.

Le light of sun impact all objects because shaders are coded in the mesh.fx effect file

Code: Select all
/// ComputeLight
///
/// Computes the sun's contribution to the pixel's color given the dot product
/// of the light direction and surface normal.  The dot product is precomputed
/// since other portions of the pixel shader might need it (and we need to reuse
/// as many calculations as possible.)
float3 ComputeLight( float dotLightNormal, float attenuation)
{
    /// Typical L.N calculation.
    float3 light = sunDiffuse * saturate( dotLightNormal ) * attenuation + sunAmbient;
    /// The following will "fill in" the shadow color proportional to the absence of light.
    /// This considers the absence of light due to shadows and surface normals pointing away from the light.
    /// This way all dark areas match (very cool.)
    return lightMultiplier * light + ( 1 - light ) * shadowFill;
}


Here is the unit with some code using sun light. We may code here others light contributions :

Code: Select all
/// UnitFalloffPS
///
/// - Similar to unit shader, with the exception that it uses the diffuse texture alpha
///   channel to mask area's in which the view dependant lookup texture is sampled.
///   Only works in Medium and High fidelity.
///
float4 UnitFalloffPS( NORMALMAPPED_VERTEX vertex, uniform bool hiDefShadows) : COLOR0
{
    if ( 1 == mirrored ) clip(vertex.depth.x);

    float3x3 rotationMatrix = float3x3( vertex.binormal, vertex.tangent, vertex.normal);
    float3 normal = ComputeNormal( normalsSampler, vertex.texcoord0.zw, rotationMatrix);
    float dotLightNormal = dot(sunDirection,normal);
   
    float4 diffuse = tex2D( albedoSampler, vertex.texcoord0.xy);
    float4 specular = tex2D( specularSampler, vertex.texcoord0.xy);
   float3 environment = texCUBE( environmentSampler, reflect( -vertex.viewDirection, normal));
   
   // Calculate lookup into falloff ramp
   float NdotV = pow(1 - saturate(dot( normalize(vertex.viewDirection), normal )), 0.6);
   float4 fallOff = tex2D( falloffSampler, float2(NdotV,vertex.material.x));
   
   // Calculate specular highlights based on current sun direction
    float3 reflection = reflect( sunDirection, normal);
    float specularAmount = saturate( dot( reflection, -vertex.viewDirection));
   float3 phongAdditive = float3 (0.5,0.6,0.7) * pow( specularAmount, 9) * specular.g;
   
   // Calculate environment map reflection
    environment *= specular.r * fallOff.a;
   
   // Calculate lighting and shadows
    float shadow = 0; // ComputeShadow( vertex.shadow, hiDefShadows);
   
    float3 light = sunDiffuse * saturate( dotLightNormal ) * shadow + sunAmbient;
    light = light + ( 1 - light ) * shadowFill;
   
   // Determine our final output color
   float3 color = diffuse.rgb * light;
   color += environment + phongAdditive;                     
   color += (fallOff.rgb * diffuse.a);                              
   
   float alpha = mirrored ? 0.5 : specular.b + glowMinimum;
   return float4( color, alpha );
}


I think we can adding some code to the fx file to add some diffuse light around from any shader effect. I do not have the skill in coding shaders to do that, but i think, it's possible, and it must add a incredible stunning refresh in the 3D engine.

Ok, we may loose some fps, but supcom has been coded before 2007, some we have a bunch amount of graphic power that can be use today.

I'm on with any project that need a financial contribution to hire a professional programmer that may add this stuff (i think this student has the skill to add this feature : http://gamedevelopment.tutsplus.com/tut ... -cms-24351)

Or maybe with some practice : http://gamedevelopment.tutsplus.com/tutorials/a-beginners-guide-to-coding-graphics-shaders--cms-23313
Franck
Crusader
 
Posts: 28
Joined: 24 Dec 2015, 16:16
Has liked: 1 time
Been liked: 1 time
FAF User Name: Franck

Re: Environemental Data

Postby nine2 » 10 Mar 2016, 23:17

Changing shaders is painful. You can do some stuff but big changes require changes to the c++ that populates them -> not possible
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Environemental Data

Postby Franck » 11 Mar 2016, 12:22

hum... ty for your reply anni.
Franck
Crusader
 
Posts: 28
Joined: 24 Dec 2015, 16:16
Has liked: 1 time
Been liked: 1 time
FAF User Name: Franck

Re: Environemental Data

Postby nine2 » 11 Mar 2016, 12:52

No sweat. I don't mean to bring you down... any improvement you make would be welcomed warmly. Improvement is totally possible ... you just can't change any signatures.
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Next

Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest