Skuggasveinn wrote:That was me, I've already started on the same mod for LoG2, it's working-ishJackard wrote:I remember someone modded a flooded dungeon for the first game?![]()
To say it's a hack is an understatement, but so was flooded dungeon for LoG1, limitations are that you can't have water that sinks the party on the same level as the ankle deep water.
It uses a new model for the waterplane that has the water shader applied to it, so it's not a heightmap trick.SpoilerShow
Will this now be possible with the new Umods? My understanding of it all is too limited to know if it can be done?Isaac wrote: ↑Tue Dec 23, 2014 8:36 am I truly wish that the water object's elevation attribute, had been used as the surface elevation for the water; on the modding side, it would have made things much more controllable. Perhaps (if it's not a can of worms to implement) we may see this in a future patch from the glögi sessions... if there are to be any.![]()
Code: Select all
defineObject{
name = "water_surface_example",
baseObject = "base_floor_decoration",
components = {
{ -- All default values are shown here
-- updates global reflection and refraction maps
class = "WaterSurface",
-- This vector is the color of the fog that appears while the
-- party is underwater. Values above 1 have the same effect as
-- 1, values below 0 and NaN have the same effect as 0.
fogColor = vec(0,0,0),
-- This is how "dense" the fog is, i.e. how quickly it becomes
-- completely opaque. I am not sure how this is scaled; a value
-- of 0 (or lower, or NaN) disables the fog entirely, but a
-- value of 1 does not make the fog reach full opacity immediately
-- (it takes about 3 meters from the camera to do so).
--
-- Interestingly, fog seems to require that a WaterSurfaceMesh be
-- present on the object, otherwise it doesn't do anything.
fogDensity = 0,
-- planeY is the offset of the reflection plane (the plane
-- about which reflections are calculated). Logically, this
-- should be the same as the y position of the WaterSurfaceMesh
-- or whatever other model you're using with the water material,
-- but there are reasons to set it to other values (it's actually
-- set to other values often in the standard assets).
planeY = -1.2,
-- This vector modifies the color of the reflected scene.
-- Negative values work.
reflectionColor = vec(1,1,1),
-- This vector modifies the color of the refracted scene. (The
-- refracted scene means the objects that are *beneath*
-- the water.) Negative values work.
refractionColor = vec(1,1,1),
},
{ -- These aren't defaults
-- builds a continuous mesh from underwater tiles
class = "WaterSurfaceMesh",
-- Material used while the party is above water.
material = "water_surface_calm",
-- Material used while the party is underwater.
underwaterMaterial = "water_surface_underwater",
-- This is how you change the "water level"; by offsetting the
-- WaterSurfaceMeshComponent. Remember to adjust the
-- WaterSurfaceComponent's planeY value. Also, be aware that
-- positive y offsets can cause very strange behaviour with
--
offset = vec(0,-1,0),
},
},
dontAdjustHeight = true,
editorIcon = 264,
}
Code: Select all
defineMaterial{
name = "ocean_water",
shader = "ocean_water",
diffuseMap = "assets/textures/env/ocean_foam_dif.tga",
normalMap = "assets/textures/env/ocean_normal.tga",
displacementMap = "assets/textures/env/ocean_disp.tga",
doubleSided = false,
lighting = true,
alphaTest = false,
blendMode = "Translucent",
textureAddressMode = "Wrap",
glossiness = 80,
depthBias = 0,
texOffset = 0,
foamOffset = 0,
foamAmount = 1,
waveAmplitude = 50,
onUpdate = function(self, time)
self:setParam("texOffset", time*0.2)
end,
}
Code: Select all
defineTile{
name = "dungeon_floor_flooded",
editorIcon = 192,
color = {120,120,180,255},
builder = "dungeon",
floor = {
"dungeon_floor_dirt_01", 1,
},
ceiling = {
"dungeon_ceiling", 1,
},
wall = {
"dungeon_wall_01", 35,
"dungeon_wall_02", 35,
"dungeon_wall_drain", 2,
},
pillar = {
"dungeon_pillar", 1,
},
ceilingEdgeVariations = true,
ceilingShaft = "dungeon_ceiling_shaft",
underwater = true, -- so that WaterSurfaceMeshComponent builds the mesh over it
moveSound = "party_move_wade",
}
Code: Select all
defineObject{
name = "water_surface_flooded_dungeon",
baseObject = "base_floor_decoration",
components = {
{
class = "WaterSurface",
planeY = 0.4, -- Notice that the planeY is the same as the y offset of the mesh
reflectionColor = vec(0.77, 0.9, 1.0) * 0.9,
refractionColor = vec(1,1,1),
},
{
class = "WaterSurfaceMesh",
material = "water_surface_calm",
underwaterMaterial = "water_surface_underwater",
offset = vec(0,0.4,0),
},
},
dontAdjustHeight = true,
editorIcon = 264,
}
Code: Select all
defineMaterial{
name = "water_surface_calm",
shader = "ocean_water",
diffuseMap = "assets/textures/env/ocean_foam_dif.tga",
normalMap = "assets/textures/env/ocean_normal.tga",
displacementMap = "assets/textures/env/ocean_disp.tga",
doubleSided = false,
lighting = true,
alphaTest = false,
blendMode = "Translucent",
textureAddressMode = "Wrap",
glossiness = 80,
depthBias = 0,
texOffset = 0,
foamOffset = 0,
foamAmount = 0,
waveAmplitude = 0.04,
onUpdate = function(self, time)
self:setParam("texOffset", time*0.03)
end,
}