Skip to content

Instantly share code, notes, and snippets.

@ethanaeris
Last active September 11, 2022 07:17
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ethanaeris/9d5213b11ed68bde6b8e9bda7e57173b to your computer and use it in GitHub Desktop.
Save ethanaeris/9d5213b11ed68bde6b8e9bda7e57173b to your computer and use it in GitHub Desktop.
Fast Landscape for Blender 2.8
# -*- coding: utf-8 -*-
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
bl_info = {
"name": "Fast Landscape",
"description": "Fast Landscape",
"author": "Laurent Laget",
"version": (0, 4, ),
"blender": (2, 80, 1),
"location": "keyboard",
"warning": "Press Ctrl Alt O to use the pie",
"wiki_url": "",
"category": "3d View"
}
import bpy
from bpy.types import Menu
# Pie Fast Landscape - Ctrl alt O
class VIEW3D_PIE_workspaces(Menu):
bl_idname = "pie.landscape"
bl_label = "Landscape"
def draw(self, context):
layout = self.layout
#layout.operator_context = 'INVOKE_REGION_WIN'
pie = layout.menu_pie()
col = pie.split().column()
row = col.split(align=True)
pie.operator("class.terrain", text ="Terrain", icon ='MESH_GRID')
pie.operator("class.water", text ="Water", icon ='MOD_OCEAN')
pie.operator("class.fastsky", text ="fastsky", icon ='MAT_SPHERE_SKY')
pie.operator("class.collider", text ="Collider", icon ='MOD_WAVE')
class terrain(bpy.types.Operator):
bl_idname = "class.terrain"
bl_label = "terrain"
bl_options = {'REGISTER', 'UNDO'}
def invoke(self, context, event):
#Set Eevee
bpy.context.scene.render.engine = 'BLENDER_EEVEE'
#creation plane
bpy.ops.mesh.primitive_plane_add(size=2,enter_editmode=False, location=(0, 0, 0))
bpy.context.object.name = "terrain"
t = bpy.context.object.name
#initial scale and subdivision
bpy.ops.object.editmode_toggle()
bpy.ops.transform.resize(value=(2, 2, 2), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)
bpy.ops.mesh.subdivide(number_cuts=10, smoothness=0)
bpy.ops.mesh.subdivide(number_cuts=10, smoothness=0)
bpy.ops.object.editmode_toggle()
bpy.ops.object.shade_smooth()
#Hair setup
bpy.ops.object.particle_system_add()
#bpy.context.object.active_index = 0
bpy.context.object.particle_systems["ParticleSettings"].name = "grass_particles"
terrain = bpy.data.objects[t]
par_set = bpy.data.particles['ParticleSettings']
terrain.particle_systems['grass_particles'].settings = par_set
bpy.data.particles["ParticleSettings"].use_modifier_stack = True
bpy.data.particles["ParticleSettings"].type = 'HAIR'
bpy.data.particles["ParticleSettings"].hair_length = 0.08
bpy.data.particles["ParticleSettings"].count = 1250
bpy.data.particles["ParticleSettings"].child_type = 'INTERPOLATED'
bpy.data.particles["ParticleSettings"].root_radius = 0.1
bpy.ops.object.vertex_group_add()
bpy.context.object.particle_systems["grass_particles"].vertex_group_density = "Group"
#Sculpt mode
bpy.ops.sculpt.sculptmode_toggle()
obj = bpy.context.active_object
#creation material
mat_name = "M_terrain"
materials = bpy.data.materials
mat = materials.get(mat_name) or materials.new(mat_name)
if mat is None:
mat = bpy.data.materials.new(name="M_terrain")
if obj.data.materials:
obj.data.materials[0] = mat
else:
obj.data.materials.append(mat)
#creation shader
mat.use_nodes = True
nodes = mat.node_tree.nodes
mat = materials.get(mat_name) or materials.new(mat_name)
for node in nodes:
nodes.remove(node)
#geometry and position node
node_geo = nodes.new('ShaderNodeNewGeometry')
node_geo.location = (-1100,100)
#separate xyz node
node_xyz = nodes.new('ShaderNodeSeparateXYZ')
node_xyz.location =(-900,100)
#gradient altitude
gradient_alt = nodes.new(type='ShaderNodeValToRGB')
gradient_alt.location = (-700,0)
gradient_alt.color_ramp.elements[0].color = (1, 1, 1, 1)
gradient_alt.color_ramp.elements[1].color = (0, 0, 0, 1)
#shader low altitude
node = nodes.new('ShaderNodeBsdfDiffuse')
node.location = (50,-200)
node.inputs[0].default_value = (0.05,0.013,0.008,1)
#noise low altitude
noise_node = nodes.new(type='ShaderNodeTexNoise')
noise_node.location = -400,-200
noise_node.inputs[1].default_value = (100)
#gradient low altitude
gradient_node = nodes.new(type='ShaderNodeValToRGB')
gradient_node.location = -230,-200
gradient_node.color_ramp.elements[0].color = (0.04, 0.005, 0.003, 1)
gradient_node.color_ramp.elements[1].color = (0.09, 0.011, 0.007, 1)
#shader high altitude
node_high = nodes.new('ShaderNodeBsdfGlossy')
node_high.location = (-150,150)
node_high.inputs[0].default_value = (0.9,0.9,0.9,1)
node_high.inputs[1].default_value = (0.8)
#shader green
node_green = nodes.new('ShaderNodeBsdfDiffuse')
node_green.location = (-150,300)
node_green.inputs[0].default_value = (0.06,0.3,0.08,1)
#mix high and green
node_mg = nodes.new('ShaderNodeMixShader')
node_mg.location = (50,225)
#mix low and high
node_mix = nodes.new('ShaderNodeMixShader')
node_mix.location = (250,-30)
#node_divider
node_div = nodes.new('ShaderNodeMath')
node_div.location = (40,0)
node_div.operation = ('DIVIDE')
node_div.inputs[1].default_value = 1.05
#node_bump
node_bump = nodes.new('ShaderNodeBump')
node_bump.location = (-180,-450)
#output
node_output = nodes.new(type='ShaderNodeOutputMaterial')
node_output.location = 500,100
#creation of links
#link low to mix shader
mat.node_tree.links.new(node.outputs['BSDF'], node_mix.inputs[2])
#link high to mix shader
mat.node_tree.links.new(node_high.outputs['BSDF'], node_mg.inputs[2])
#link green to mix shader
mat.node_tree.links.new(node_green.outputs['BSDF'], node_mg.inputs[1])
#link gradient altitude to divide
mat.node_tree.links.new(gradient_alt.outputs[0], node_div.inputs[0])
#link divide to mix
mat.node_tree.links.new(node_div.outputs[0], node_mix.inputs[0])
#link xyz to fac node_mg
mat.node_tree.links.new(node_xyz.outputs[2], node_mg.inputs[0])
#link node_mg to node_mix
mat.node_tree.links.new(node_mg.outputs[0], node_mix.inputs[1])
#link noise to ground gradient
mat.node_tree.links.new(noise_node.outputs[0], gradient_node.inputs[0])
#link ground gradient to color of node
mat.node_tree.links.new(gradient_node.outputs[0], node.inputs[0])
#link the geometry node to z separate
mat.node_tree.links.new(node_geo.outputs[0], node_xyz.inputs[0])
#link the z separate to gradient altitude
mat.node_tree.links.new(node_xyz.outputs[2], gradient_alt.inputs[0])
#link noise to vector bump
mat.node_tree.links.new(noise_node.outputs[0], node_bump.inputs[2])
#link vector bump to shader
mat.node_tree.links.new(node_bump.outputs[0], node.inputs[2])
mat.node_tree.links.new(node_bump.outputs[0], node_high.inputs[2])
#link to output
mat.node_tree.links.new(node_mix.outputs[0], node_output.inputs['Surface'])
return {'FINISHED'}
class water(bpy.types.Operator):
bl_idname = "class.water"
bl_label = "water"
bl_options = {'REGISTER', 'UNDO'}
def invoke(self, context, event):
#Set Eevee
bpy.context.scene.render.engine = 'BLENDER_EEVEE'
#Creation of reflection probe
bpy.ops.object.lightprobe_add(type='CUBEMAP', enter_editmode=False, location=(0, 0, 0))
bpy.ops.transform.resize(value=(16, 16, 16), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)
#Creation of indirect lighting probe
bpy.ops.object.lightprobe_add(type='GRID', enter_editmode=False, location=(0, 0, 0))
bpy.ops.transform.resize(value=(16, 16, 16), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)
#creation ground
bpy.ops.mesh.primitive_plane_add(size=30,enter_editmode=False, location=(0, 0, -25))
bpy.context.object.name = "Ground"
bpy.ops.object.editmode_toggle()
bpy.ops.transform.resize(value=(2, 2, 2), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)
bpy.ops.object.editmode_toggle()
#creation water plane
bpy.ops.mesh.primitive_plane_add(location=(0, 0, -0.8))
#name and creation modifier ocean
bpy.context.object.name = "Ocean"
bpy.ops.object.modifier_add(type='OCEAN')
#setup modifier ocean
bpy.context.object.modifiers["Ocean"].repeat_x = 1
bpy.context.object.modifiers["Ocean"].repeat_y = 1
bpy.context.object.modifiers["Ocean"].resolution = 14
bpy.context.object.modifiers["Ocean"].wave_scale = 2
bpy.context.object.modifiers["Ocean"].foam_coverage = 0.5
bpy.context.object.modifiers["Ocean"].use_normals = True
bpy.context.object.modifiers["Ocean"].use_foam = True
bpy.context.object.modifiers["Ocean"].foam_layer_name = "foam_layer"
bpy.ops.object.editmode_toggle()
bpy.ops.uv.smart_project()
bpy.ops.object.editmode_toggle()
obj = bpy.context.active_object
#creation material
mat_name = "M_ocean"
materials = bpy.data.materials
mat = materials.get(mat_name) or materials.new(mat_name)
if mat is None:
mat = bpy.data.materials.new(name="M_ocean")
if obj.data.materials:
obj.data.materials[0] = mat
else:
obj.data.materials.append(mat)
###creation shader###
mat.use_nodes = True
nodes = mat.node_tree.nodes
mat = materials.get(mat_name) or materials.new(mat_name)
for node in nodes:
nodes.remove(node)
#node blue water
water_node = nodes.new('ShaderNodeBsdfPrincipled')
#water_node = nodes.new('ShaderNodeBsdfGlass')
water_node.location = (80,50)
water_node.distribution=('MULTI_GGX')
water_node.inputs[0].default_value = (0.127,0.59,0.8,1)
water_node.inputs[4].default_value = (0.1)
water_node.inputs[7].default_value = (0.05)
water_node.inputs[14].default_value = (1.330)
water_node.inputs[15].default_value = (1)
water_node.label = ('Water Shader')
bpy.context.scene.eevee.use_ssr = True
bpy.context.scene.eevee.use_ssr_refraction = True
bpy.context.object.active_material.blend_method = 'BLEND'
bpy.context.object.active_material.use_screen_refraction = True
#texture noise for bump
noise_node = nodes.new('ShaderNodeTexNoise')
noise_node.location = (-700,50)
noise_node.inputs[1].default_value = (4)
noise_node.inputs[3].default_value = (1)
#gradient water
gradient_water_node = nodes.new(type='ShaderNodeValToRGB')
gradient_water_node.location = (-530,50)
gradient_water_node.color_ramp.elements[0].color = (1, 1, 1, 1)
gradient_water_node.color_ramp.elements[1].color = (0, 0, 0, 1)
#vector bump node
bump_water_node = nodes.new('ShaderNodeBump')
bump_water_node.location = (-250,50)
bump_water_node.inputs[0].default_value = (0.5)
#foam attribute
foam_node = nodes.new('ShaderNodeAttribute')
foam_node.location = (-550,300)
foam_node.attribute_name = ('foam_layer')
foam_node.label = ('Foam Attribute')
#Multiply foam node
multiply_foam_node = nodes.new('ShaderNodeMath')
multiply_foam_node.location = (-350,300)
multiply_foam_node.operation = ('MULTIPLY')
multiply_foam_node.inputs[0].default_value = (2)
#wetmap attribute
wet_node = nodes.new('ShaderNodeAttribute')
wet_node.location = (-550,500)
wet_node.attribute_name = ('dp_wetmap')
wet_node.label = ('Wet Attribute')
#Multiply wetmap node
multiply_wet_node = nodes.new('ShaderNodeMath')
multiply_wet_node.location = (-350,500)
multiply_wet_node.operation = ('MULTIPLY')
multiply_wet_node.inputs[0].default_value = (10)
#Second Principled shader, half part of foam
diffuse_foam_node = nodes.new(type='ShaderNodeBsdfPrincipled')
diffuse_foam_node.location = (80,660)
diffuse_foam_node.inputs[7].default_value = (0.1)
diffuse_foam_node.inputs[12].default_value = (1)
diffuse_foam_node.inputs[14].default_value = (1.33)
diffuse_foam_node.inputs[15].default_value = (0.5)
#Mix rgb foam and wet
mix_attributes_node = nodes.new(type='ShaderNodeMixRGB')
mix_attributes_node.location = (-100,460)
mix_attributes_node.blend_type = ('ADD')
mix_attributes_node.inputs[0].default_value = (1)
mix_attributes_node.use_clamp = True
#mix two principled shaders for foam node
mix_foam_node = nodes.new('ShaderNodeMixShader')
mix_foam_node.location = (400,310)
mix_foam_node.label = ('Mix Foam nodes')
#noise for foam and wet
noise_foam_node = nodes.new('ShaderNodeTexNoise')
noise_foam_node.location = (-350,800)
noise_foam_node.label = ('Noise')
noise_foam_node.inputs[1].default_value = (100)
#ramp for noise
ramp_noise_node = nodes.new('ShaderNodeValToRGB')
ramp_noise_node.location = (-180,800)
#vector bump node 2 for foam and wet
bump_foam_node = nodes.new('ShaderNodeBump')
bump_foam_node.location = (-350,1000)
bump_foam_node.inputs[0].default_value = (0.25)
#node output
node_output = nodes.new(type='ShaderNodeOutputMaterial')
node_output.location = 600,100
#####LINKS#####
#link noise to water gradient
mat.node_tree.links.new(noise_node.outputs[0] , gradient_water_node.inputs[0])
#link water gradient to vector bump
mat.node_tree.links.new(gradient_water_node.outputs[0] , bump_water_node.inputs[2])
#link bump vector node to water_node
mat.node_tree.links.new(bump_water_node.outputs[0], water_node.inputs[19])
#link attribute foam to multiply foam node of mix attributes
mat.node_tree.links.new(foam_node.outputs[0], multiply_foam_node.inputs[1])
#Link multiply foam to vector node mix attributes
mat.node_tree.links.new(multiply_foam_node.outputs[0], mix_attributes_node.inputs[1])
##
#link attribute wet to multiply wet node of mix attributes
mat.node_tree.links.new(wet_node.outputs[0], multiply_wet_node.inputs[1])
#Link multiply wet to vector node mix attributes
mat.node_tree.links.new(multiply_wet_node.outputs[0], mix_attributes_node.inputs[2])
#link mix attributes to vector mix shader
mat.node_tree.links.new(mix_attributes_node.outputs[0], mix_foam_node.inputs[0])
#link water node to mix
mat.node_tree.links.new(water_node.outputs['BSDF'], mix_foam_node.inputs[1])
#link diffuse_foam_node to mix
mat.node_tree.links.new(diffuse_foam_node.outputs['BSDF'], mix_foam_node.inputs[2])
#link noise to ramp
mat.node_tree.links.new(noise_foam_node.outputs[0], ramp_noise_node.inputs[0])
#link ramp to shader diffuse foam
mat.node_tree.links.new(ramp_noise_node.outputs[0], diffuse_foam_node.inputs[0])
#link bump noise to rampfoam 2
mat.node_tree.links.new(ramp_noise_node.outputs[0], bump_foam_node.inputs[2])
#link rampfoam 2 to bump socket of shader diffuse foam
mat.node_tree.links.new(bump_foam_node.outputs[0], diffuse_foam_node.inputs[19])
#link mix node to output
mat.node_tree.links.new(mix_foam_node.outputs[0], node_output.inputs['Surface'])
###apply dynamic paint and setup the ocean as a canvas###
bpy.ops.object.modifier_add(type='DYNAMIC_PAINT')
bpy.context.object.modifiers["Dynamic Paint"].ui_type = 'CANVAS'
bpy.ops.dpaint.type_toggle(type='CANVAS')
bpy.ops.dpaint.output_toggle(output='A')
bpy.ops.dpaint.output_toggle(output='B')
bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Surface"].use_dissolve = True
bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Surface"].use_antialiasing = True
###apply a second layer of dynamic paint with a wave effect###
bpy.ops.dpaint.surface_slot_add()
bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Surface.001"].name = "Onde"
bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Onde"].surface_type = 'WAVE'
bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Onde"].use_antialiasing = True
bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Onde"].use_wave_open_border = True
return {'FINISHED'}
class collider(bpy.types.Operator):
bl_idname = "class.collider"
bl_label = "collider"
bl_options = {'REGISTER', 'UNDO'}
def invoke(self, context, event):
#apply dynamic paint, and setup the object as a brush
bpy.ops.object.modifier_add(type='DYNAMIC_PAINT')
bpy.context.object.modifiers["Dynamic Paint"].ui_type = 'BRUSH'
bpy.ops.dpaint.type_toggle(type='BRUSH')
bpy.context.object.modifiers["Dynamic Paint"].brush_settings.paint_source = 'VOLUME_DISTANCE'
bpy.context.object.modifiers["Dynamic Paint"].brush_settings.paint_distance = 1
bpy.context.object.modifiers["Dynamic Paint"].brush_settings.wave_factor = 1
return {'FINISHED'}
#classe fastsky
class fastsky(bpy.types.Operator):
"""description"""
bl_idname = "class.fastsky"
bl_label = "fastsky"
bl_options = {'REGISTER', 'UNDO'}
def invoke(self, context, event):
# bpy.context.space_data.context = 'WORLD'
bpy.ops.world.new()
bpy.context.scene.world.name = "sky"
scn = bpy.context.scene
# scn.render.engine = 'CYCLES'
scn.world.use_nodes = True
#select world node tree
wd = scn.world
nt = bpy.data.worlds[wd.name].node_tree
#create sky
sky_node = nt.nodes.new(type="ShaderNodeTexSky")
sky_node.location =(-1500,450)
#find location of Background node
background_node = nt.nodes['Background']
#Connect color out of Grad node to Color in of Background node
sky_node_output = sky_node.outputs['Color']
sky_node_input = background_node.inputs['Color']
#nt.links.new(sky_node_output, sky_node_input)
#texture coordinate node
coord_node = nt.nodes.new(type="ShaderNodeTexCoord")
coord_node.location = (-2800,0)
#texture coordinate node
map_node = nt.nodes.new(type="ShaderNodeMapping")
map_node.location = (-2600,0)
map_node.scale = (0,0,1)
#coloramp 1 horizon nuages
ramp1_node = nt.nodes.new(type="ShaderNodeValToRGB")
ramp1_node.location = (-2200,0)
ramp1_node.color_ramp.elements[0].color = (1, 1, 1, 1)
ramp1_node.color_ramp.elements[1].color = (0, 0, 0, 1)
ramp1_node.color_ramp.elements[1].position = (0.155)
#Multiply node
mult1_node = nt.nodes.new(type="ShaderNodeMath")
mult1_node.operation = 'MULTIPLY'
mult1_node.inputs[1].default_value = (15)
mult1_node.location = (-2200,150)
#Noise texture for clouds
clouds_node = nt.nodes.new(type="ShaderNodeTexNoise")
clouds_node.inputs[2].default_value = (16)
clouds_node.inputs[3].default_value = (0)
clouds_node.label = ("Clouds")
clouds_node.location = (-2000,160)
#coloramp 2 grayscale convertor
ramp2_node = nt.nodes.new(type="ShaderNodeValToRGB")
ramp2_node.location = (-1800,160)
ramp2_node.color_ramp.elements[0].color = (1, 1, 1, 1)
ramp2_node.color_ramp.elements[1].color = (0, 0, 0, 1)
ramp2_node.color_ramp.elements[1].position = (0.559)
ramp2_node.label = ("Cloud color and brightness")
ramp2_node.use_custom_color = True
ramp2_node.color = (0.8, 0.8, 1)
#mult 2 aka couverture nuageuse
couv_node = nt.nodes.new(type="ShaderNodeMath")
couv_node.operation = 'MULTIPLY'
couv_node.inputs[1].default_value = (1)
couv_node.location = (-1500,150)
couv_node.label = ("Clouds cover")
couv_node.use_custom_color = True
couv_node.color = (1, 1, 1)
#mix_node 1
mix1_node = nt.nodes.new(type="ShaderNodeMixRGB")
mix1_node.location = (-1300,150)
mix1_node.label = ("mix horizon")
mix1_node.inputs[2].default_value = (0,0,0,1)
#mix_node 2
mix2_node = nt.nodes.new(type="ShaderNodeMixRGB")
mix2_node.location = (-1000,150)
mix2_node.label = ("mix sky")
#transition gamma node
transition_node = nt.nodes.new(type="ShaderNodeGamma")
transition_node.location = (-1300,300)
transition_node.label = ("Transition day night")
transition_node.use_custom_color = True
transition_node.color = (0.00223385, 0.0560615, 1)
#mix sky plus stars
mix3_node = nt.nodes.new(type="ShaderNodeMixRGB")
mix3_node.location = (-800,0)
mix3_node.label = ("sky with stars")
#Noise texture for stars
stars_node = nt.nodes.new(type="ShaderNodeTexNoise")
stars_node.inputs[1].default_value = (500)
stars_node.inputs[2].default_value = (2)
stars_node.label = ("Stars")
stars_node.location = (-2000,-320)
#coloramp 3 grayscale convertor for stars
ramp3_node = nt.nodes.new(type="ShaderNodeValToRGB")
ramp3_node.location = (-1800,-320)
ramp3_node.color_ramp.elements[0].color = (1, 1, 1, 1)
ramp3_node.color_ramp.elements[1].color = (0, 0, 0, 1)
ramp3_node.color_ramp.elements[1].position = (0.282)
#mult 3 aka eclat etoile
shine_node = nt.nodes.new(type="ShaderNodeMath")
shine_node.operation = 'MULTIPLY'
shine_node.inputs[1].default_value = (10)
shine_node.location = (-1500,-320)
shine_node.label = ("Shine star")
shine_node.use_custom_color = True
shine_node.color = (0.608, 0.51, 0)
#mix horizon etoiles plus stars
mix4_node = nt.nodes.new(type="ShaderNodeMixRGB")
mix4_node.inputs[2].default_value = (0,0,0,1)
mix4_node.location = (-1300,-320)
mix4_node.label = ("mix horizon with stars")
#coloramp 4 grayscale convertor
ramp4_node = nt.nodes.new(type="ShaderNodeValToRGB")
ramp4_node.location = (-1300,-160)
ramp4_node.color_ramp.elements[0].color = (1, 1, 1, 1)
ramp4_node.color_ramp.elements[1].color = (0, 0, 0, 1)
ramp4_node.color_ramp.elements[1].position = (0.559)
#link coordinates to mapping
nt.links.new(coord_node.outputs[0], map_node.inputs[0])
#link mapping to coloramp 1
nt.links.new(map_node.outputs[0], ramp1_node.inputs[0])
#link coordinates to mult1
nt.links.new(map_node.outputs[0], mult1_node.inputs[0])
#link mult1 to clouds_node
nt.links.new(mult1_node.outputs[0], clouds_node.inputs[1])
#link clouds_node to ramp2_node
nt.links.new(clouds_node.outputs[0], ramp2_node.inputs[0])
#link ramp2_node to couv_node
nt.links.new(ramp2_node.outputs[0], couv_node.inputs[0])
#link couv_node to mix1_node
nt.links.new(couv_node.outputs[0], mix1_node.inputs[1])
#link coloramp 1 to mix1_node factor
nt.links.new(ramp1_node.outputs[0], mix1_node.inputs[0])
#link mix1_node to mix sky factor
nt.links.new(mix1_node.outputs[0], mix2_node.inputs[0])
#link ramp2_node to mix sky color 2
nt.links.new(ramp2_node.outputs[0], mix2_node.inputs[2])
#link transition_node to mix sky color 1
nt.links.new(transition_node.outputs[0], mix2_node.inputs[1])
#link transition_node to mix sky color 1
nt.links.new(sky_node.outputs[0], transition_node.inputs[0])
#link mix 2 with mix3
nt.links.new(mix2_node.outputs[0], mix3_node.inputs[1])
#link stars with ramp3
nt.links.new(stars_node.outputs[0], ramp3_node.inputs[0])
#link ramp 3 with shine
nt.links.new(ramp3_node.outputs[0], shine_node.inputs[0])
#link shine with mix horizon stars
nt.links.new(shine_node.outputs[0], mix4_node.inputs[1])
#link mix 4 with mix 3
nt.links.new(mix4_node.outputs[0], mix3_node.inputs[2])
#link ramp 1 to mix 4
nt.links.new(ramp1_node.outputs[0], mix4_node.inputs[0])
#link ramp 4 to mix 3 factor
nt.links.new(ramp4_node.outputs[0], mix3_node.inputs[0])
#link mix3 to background
nt.links.new(mix3_node.outputs[0], background_node.inputs[0])
return {'FINISHED'}
classes = (
VIEW3D_PIE_workspaces,
terrain,
water,
collider,
fastsky,
)
addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
kc = bpy.context.window_manager.keyconfigs.addon
if wm.keyconfigs.addon:
km = wm.keyconfigs.addon.keymaps.new(name = "Window",space_type='EMPTY', region_type='WINDOW')
kmi = km.keymap_items.new('wm.call_menu_pie', 'O', 'PRESS' ,alt=True,ctrl=True)
kmi.properties.name = "pie.landscape"
addon_keymaps.append((km,kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":
register()
@ethanaeris
Copy link
Author

ethanaeris commented Jul 9, 2019

Fast Landscape for Blender 2.8
Installation:

Start Blender and open User Preferences. Click on the addons tab
Click “install from file” , then choose downloaded zip or .py
Check the addon to activate, then close user preferences (it is now automatically saved !)

To use , ctr+alt+ O , then choose your part.

For the ocean part , the settings are in the modifiers tab (resolution, foam coverage, etc).

For the terrain part, use common sculpt tools to edit the terrain.
Swap in Vertex weight paint mode to change the grass. Grass parameters in Particles Tab

For the collider, just select an object before then use the pie and choose Collider. it will be setup for collision with ocean.
you can modify parameters in Physics tab.

About the fastsky, it works only in cycles engine for now.
You can edit it in the shader editor, world section.
Main parameters are in theses nodes :

  • Sky texture to set the angle of the sun , and make a dawn-ish mood .
  • Transition Day-night . higher number make the sky darker , for night moods.
  • Clouds cover - higher numbers add more clouds.
  • Shine stars - it Controls the brightness of the stars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment