Planetside Software Forums

General => Terragen Discussion => Topic started by: scrambled2 on November 08, 2012, 08:21:03 PM

Title: Adjusting all Y height at the end.
Post by: scrambled2 on November 08, 2012, 08:21:03 PM
Quick question again. Say I have my world with my terrain, shaders, and everything else all set up and ready to go. Let's say it's complex. I want to animate the height of everything in my scene so that at frame 40 I was at normal height as computed by my node-tree previously, but at frame 1 the height of everything was zero and the world was flat. If it was a simple heightfield, I know I could use the heightfield multiplier, but this tree is complex with heightfields, procedurals...ect. Would I just apply a function at the end of the tree? I haven't played with the blue nodes thus far and I am experimenting with animated events. Thanks for any help you can provide.

Chris
Title: Re: Adjusting all Y height at the end.
Post by: Oshyan on November 08, 2012, 08:31:41 PM
I don't know the mathematical implications of this, but I think there's a potentially simple way of doing this which is to create a Merge Shader and feed the output of your complex shader network into both its Input and Shader A inputs, then set Merge Mode to Subtract (Input - A). Now at a "Mix to A" value of 1 your terrain will be flat, and at 0 it will be back to your normal terrain. You can animate the "Mix to A" value.

Pasted below is a clip file of a simple setup with a single Power Fractal and a Merge Shader doing this; simply copy the entire text and then paste into your node network and the nodes should be created.

Quote<terragen_clip>
   <merge_shader
      name = "Merge shader 01"
      gui_use_node_pos = "1"
      gui_node_pos = "-720 560 0"
      gui_group = ""
      enable = "1"
      input_node = "Fractal terrain 01"
      gui_use_preview_patch_size = "0"
      gui_preview_patch_size = "1000 1000"
      shader_A = "Fractal terrain 01"
      mix_to_A = "1"
      mix_controller = ""
      choose_by_altitude = "0"
      merge_colour = "1"
      colour_merge_mode = "2"
      merge_displacement = "1"
      displace_merge_mode = "2"
      >
   </merge_shader>
   <power_fractal_shader_v3
      name = "Fractal terrain 01"
      gui_use_node_pos = "1"
      gui_node_pos = "-840 640 0"
      gui_group = "Terrain"
      enable = "1"
      input_node = "/Heightfield shader 01"
      gui_use_preview_patch_size = "0"
      gui_preview_patch_size = "1000 1000"
      seed = "34040"
      feature_scale = "5000"
      lead-in_scale = "25000"
      smallest_scale = "0.1"
      noise_octaves = "20"
      apply_high_colour = "0"
      high_colour = "1 1 1"
      apply_low_colour = "0"
      low_colour = "0 0 0"
      colour_contrast = "0.5"
      colour_offset = "0"
      colour_roughness = "5"
      clamp_high_colour = "1"
      clamp_low_colour = "1"
      apply_displacement = "1"
      displacement_direction = "1"
      displacement_amplitude = "2000"
      displacement_offset = "0"
      displacement_roughness = "0.875"
      displacement_spike_limit = "0.25"
      continue_spike_limit = "1"
      adjust_coastline = "0"
      coastline_altitude = "0"
      coastline_smoothing = "30"
      noise_flavour = "3"
      noise_variation = "2"
      variation_method = "2"
      buoyancy_from_variation = "0.5"
      clumping_of_variation = "0.25"
      noise_stretch_XYZ = "1 1 1"
      distort_by_normal = "0"
      distortion_by_normal = "5"
      lead-in_warp_effect = "1"
      lead-in_warp_amount = "0.75"
      less_warp_at_feature_scale = "1"
      allow_vertical_warp = "0"
      blend_by_shader = "0"
      blending_shader = ""
      fit_blendshader_to_this = "0"
      invert_blendshader = "0"
      >
   </power_fractal_shader_v3>
</terragen_clip>

- Oshyan
Title: Re: Adjusting all Y height at the end.
Post by: Matt on November 09, 2012, 01:38:07 AM
Calling the same shader network twice will increase render times. I would make one small change to Oshyan's setup. Set the Merge Shader's displacement mode to "Multiply Input * A's Diffuse Colour" and merge with a shader or function that generates a diffuse colour of 0 (e.g. a Constant Scalar with the value 0). That should flatten the displacement.

Matt
Title: Re: Adjusting all Y height at the end.
Post by: Oshyan on November 09, 2012, 11:28:31 AM
Ah yes, so there is the mathematical implication. ;) Of course blending with a Constant made sense, but the above just seemed too simple and slick not to mention, processing time considerations excepted.

- Oshyan