Page 4 of 5
Re: Re:
Posted: Mon Apr 13, 2015 2:21 am
by minmay
Isaac wrote:Is it interactive, or decorative? This is news to me; and sounds neat.
The ocean water is at a different height from the rest of the water in the game.
Since that video is so low-resolution, I can't actually tell for sure, but it looks like you didn't adjust the planeY value of your WaterSurfaceComponent. It should be the same height as your water mesh.
Isaac wrote:(Too bad it doesn't move the water mesh.)
I'm pretty sure you should only move the mesh (Component:setOffset()) and change the planeY value of the WaterSurfaceComponent instead of moving the object with the WaterSurfaceComponent.
Re: Re:
Posted: Mon Apr 13, 2015 7:33 am
by Isaac
minmay wrote:Since that video is so low-resolution, I can't actually tell for sure, but it looks like you didn't adjust the planeY value of your WaterSurfaceComponent. It should be the same height as your water mesh.
That makes a world of difference.
So adjusting planeY does allow the reflection to function as intended.
Isaac wrote:(Too bad it doesn't move the water mesh.)
I'm pretty sure you should only move the mesh (Component:setOffset()) and change the planeY value of the WaterSurfaceComponent instead of moving the object with the WaterSurfaceComponent.
So far, I have only managed to adjust the water mesh height using the to setWorldPosition/PositionY functions on the water_surface mesh.
Re: Re:
Posted: Mon Apr 13, 2015 7:42 am
by minmay
Look at the asset pack definitions. You can use the offset property of the WaterSurfaceMeshComponent to change the height of the mesh. The planeY field of the WaterSurfaceComponent is the height of the plane that stuff is reflected across, so generally you want it to align with the mesh.
You can also use water materials on your own meshes, of course, even animated ones - there's nothing special about the ocean_water model. I can't think of any rendering limitations on dynamically changing water height while the party is above. The "problem" is that the party's underwater-ness is tied to tile and elevation. (You can hack around move sounds with a PartyComponent.onMove hook.) You could probably get around that by changing the elevation of all the objects on the level but that is a really bad idea for other reasons.
Also you can't dynamically change the level's reflection map obviously, but you could use ModelComponent:setReflection() to mostly get around that performance issue.
Re: [Guide] How to Make Outdoor Areas
Posted: Mon Apr 13, 2015 10:11 pm
by THOM
Mm - when I try to alter the heightness of a waterlevel, I get this:
https://www.dropbox.com/s/uengqqy8yyo2j ... 1.jpg?dl=0
Code: Select all
defineObject{
name = "voodooswamp_water",
baseObject = "base_floor_decoration",
components = {
{
-- updates global reflection and refraction maps
class = "WaterSurface",
planeY = 1.2,
fogColor = vec(0.5, 0.35, 0.1) * 0.3,
fogDensity = 0.3,
reflectionColor = vec(0.5, 0.5, 0.5),
refractionColor = vec(0.1, 0.2, 0.1) * 0.5,
},
{
-- builds a continuous mesh from underwater tiles
class = "WaterSurfaceMesh",
material = "water_surface_calm",
underwaterMaterial = "water_surface_underwater",
offset = vec(0, 1.2, 0),
},
},
tags = { "THOM" },
dontAdjustHeight = true,
editorIcon = 264,
}
Re: [Guide] How to Make Outdoor Areas
Posted: Wed Apr 15, 2015 12:54 am
by THOM
Does anyone has an idea whats going on on my screenshot?
Re: [Guide] How to Make Outdoor Areas
Posted: Wed Apr 15, 2015 2:21 am
by Isaac
THOM wrote:Does anyone has an idea whats going on on my screenshot?
What I would suggest, is to place a script that (on load) applies an adjusted water_surface material to the water surface object. Redefine the water_surface_calm material with a smaller wave amplitude. (say... 0.25, instead of 2)
Apply the altered copied material.
Code: Select all
--Example script
function setWater()
water_surface_underground_1.watersurfacemesh:setMaterial("water_surface_adjusted")
end
delayedCallself.go.id, 0.001, "setWater")
This works ~~with side effects. Though I would love to learn a better way to manage it.
Re: [Guide] How to Make Outdoor Areas
Posted: Wed Apr 15, 2015 2:31 am
by minmay
Isaac wrote:THOM wrote:Does anyone has an idea whats going on on my screenshot?
What I would suggest, is to place a script that (on load) applies an adjusted water_surface material to the water surface object. Redefine the water_surface_calm material with a smaller wave amplitude. (say... 0.25, instead of 2)
Apply the altered copied material.
Code: Select all
--Example script
function setWater()
water_surface_underground_1.watersurfacemesh:setMaterial("water_surface_adjusted")
end
delayedCallself.go.id, 0.001, "setWater")
The water shader only works on materials named "ocean_water", "water_surface_calm", and "water_surface_underwater". If you want more than 3 water materials you should take advantage of the onUpdate hook to change the materials' properties when needed.
Re: [Guide] How to Make Outdoor Areas
Posted: Wed Apr 15, 2015 2:43 am
by Isaac
minmay wrote:The water shader only works on materials named "ocean_water", "water_surface_calm", and "water_surface_underwater". If you want more than 3 water materials you should take advantage of the onUpdate hook to change the materials' properties when needed.
That sounds cool. Currently I've [as mentioned above] defined a copy of water_surface_calm, and applied it upon load; with the water surface raised just slightly above 0 elevation. To appear like a foot of flood water in the tunnels. I'd seen it of course, but I hadn't actually used the onUpdate hook yet.
Code: Select all
defineMaterial{
name = "water_surface_adjusted",
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 = true,
lighting = true,
alphaTest = false,
blendMode = "Translucent",
textureAddressMode = "Wrap",
glossiness = 80,
depthBias = 0,
texOffset = 0,
foamOffset = 0,
foamAmount = 0,
waveAmplitude = 0.25, --=------[changed from 2 to .25]
onUpdate = function(self, time)
self:setParam("texOffset", time*0.15)
end,
}
I'm not happy with the final effect ~yet; but it does change that to this:
And can be seen here in-game:
https://www.dropbox.com/s/0bhn1if7mq7po ... l.avi?dl=0
Re: [Guide] How to Make Outdoor Areas
Posted: Thu Apr 16, 2015 10:04 am
by Duncan1246
minmay wrote:Isaac wrote:THOM wrote:Does anyone has an idea whats going on on my screenshot?
What I would suggest, is to place a script that (on load) applies an adjusted water_surface material to the water surface object. Redefine the water_surface_calm material with a smaller wave amplitude. (say... 0.25, instead of 2)
Apply the altered copied material.
Code: Select all
--Example script
function setWater()
water_surface_underground_1.watersurfacemesh:setMaterial("water_surface_adjusted")
end
delayedCallself.go.id, 0.001, "setWater")
The water shader only works on materials named "ocean_water", "water_surface_calm", and "water_surface_underwater". If you want more than 3 water materials you should take advantage of the onUpdate hook to change the materials' properties when needed.
Your reflexions and solutions are very interesting for many modders, but I think a specific thread is necessary. Find this in "How to make outdoors areas" thread is a bit weird...
Anyway, If I understand, to obtain a flood effect, it's necessary to load the new material for the mesh in init.lua to override water_surface_underwater and create a water_surface_underground object with planeY and mesh offset adapted to the modder purpose (0.2 in your exemple). If it's correct, to modify in game the level of the water, like in the video, you call setWorldPositionY() but on that? on water_surface_underground? And how you manage the party_underwater issue?
Duncan
Re: [Guide] How to Make Outdoor Areas
Posted: Thu Dec 01, 2016 7:12 pm
by BlankGame
So i have made a ladder that i can get up successfully BUT i can not get down ... how do i fix this (without code)