Sky outside / normal lighting inside?

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
gambit37
Posts: 218
Joined: Fri Mar 02, 2012 3:40 pm

Sky outside / normal lighting inside?

Post by gambit37 »

Is it possible to create a level that's a true interior dungeon, but with an outside area that has a true sky?

I was looking at the possibility of having windows in my dungeon that look out onto a skybox. Obviously if I place a standard sky item in the level, it changes all the lighting across the entire map which makes the dungeon areas look brightly lit. Not good.

I looked at possibly building the dungeon out of wall/floor objects, but it's not really a viable solution for a whole level.
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Sky outside / normal lighting inside?

Post by Isaac »

What do you mean by 'true interior'?

Have you tried using a script_entity that spawns the entire interior room(s)?

(Alternatively, it could be a script entity that self creates model components, and offsets them; for the walls, floors, and ceilings.)

I've done this with scripts that spawn and reposition 20 models, and placed several of the scripts on the map ~each spawning its collection.

*For loops work great in a script like this.

** It doesn't technically have to be a script entity... The code can be in the onInit hook of any component... even a Null.
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Sky outside / normal lighting inside?

Post by Drakkan »

have you tried just disable / enable some of the sky components when party crossing between interior / outerior areas ?
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
gambit37
Posts: 218
Joined: Fri Mar 02, 2012 3:40 pm

Re: Sky outside / normal lighting inside?

Post by gambit37 »

@Issac: By true interior, I mean the floors/walls built using the tile painting tools, rather than placing everything by hand or script. In addition, interior levels (those without a sky object on them) have different ambient light behaviour, no fogging or cast shadows etc.

@Drakkan: Good point, I'll try that out. Thanks.

EDIT: There is actually an unused castle window model in the asset pack. Looks like the devs had the same idea but abandoned it.
User avatar
gambit37
Posts: 218
Joined: Fri Mar 02, 2012 3:40 pm

Re: Sky outside / normal lighting inside?

Post by gambit37 »

So I tried disabling sky components when the player is inside, then re-enabling them if they are looking out of a 'window'. It doesn't really work convincingly, so I abandoned it.

Instead, I've enabled the unused castle window model from the asset pack, and set up some lights for it. It's not great, but I think it's OK for now. Clearly I would need to change the internal white texture of the model (so that it could be replaced with a sky material/shader), but for now I'm just seeing what I can achieve without needing to modify any models:

Image
User avatar
Dr.Disaster
Posts: 2876
Joined: Wed Aug 15, 2012 11:48 am

Re: Sky outside / normal lighting inside?

Post by Dr.Disaster »

I think Germanny did something similar. In his tileset there is an object called dm_ceiling_breakin. When placed it shines a light down similar to your window experiment and those who look up can see sky above. Looking into that object and how it's done might help.
User avatar
THOM
Posts: 1281
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Sky outside / normal lighting inside?

Post by THOM »

That's easy: there is just a flat "screen" over the hole with a nightsky texture on it.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Sky outside / normal lighting inside?

Post by minmay »

Dr.Disaster wrote:I think Germanny did something similar. In his tileset there is an object called dm_ceiling_breakin. When placed it shines a light down similar to your window experiment and those who look up can see sky above. Looking into that object and how it's done might help.
It wouldn't, the object has absolutely nothing to do with sky, it's the same as the Grimrock 1 version but with a spot light added.

In general, SkyComponent has 5 important effects on the environment:
1. The skybox itself, obviously
2. The ambient light. This is the LightComponent called "ambient" and it illuminates every triangle on the level equally, with no particular origin or shadow casting.
3. The regular light. This is the other LightComponent and rotates around the skybox during the day, but stays stationary during night. This one does cast shadows. Think of it as a regular area light with infinite range that is infinitely far away.
4. The lens flare. When you look at the aforementioned light during the day, there's a lens flare effect that makes it look like you're looking at the sun.
5. The tonemap saturation. This field multiplies the red/green/blue saturation (but NOT brightness) of everything on the level by the specified values. It's used by the cemetery sky in the standard assets to make everything grey, but it can also be used to increase the saturation by using values above 1.0, or even invert the colours with values below 0.0.

The reason your indoor environments look goofy with SkyComponent on the level is 2, the ambient light: it's illuminating the inside of your buildings, because it lights every triangle equally. You could simply disable the component to get rid of the ambient light, but that will make the outdoor part of the level look odd, of course. The easiest solution that would still look ok is probably to fade the ambient component in and out as you enter/exit the indoor areas. IIRC both LightComponent:setBrightness() and SkyComponent:setAmbientIntensity() will work for this. Windows should look fine with the ambient light disabled/at zero brightness, since the area light, lens flare, and skybox are still there.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
gambit37
Posts: 218
Joined: Fri Mar 02, 2012 3:40 pm

Re: Sky outside / normal lighting inside?

Post by gambit37 »

Thanks for the input minmay, very helpful. I've realised however that I've not described my intentions clearly enough. There isn't actually an outside area on the map. The whole map is an interior dungeon. What I wanted to do was create windows that open onto say a single empty cell, and then apply a skybox effect to that cell, so that it would seem to be a complete sky that the player is looking at through a window.

Clearly Grimrock skies don't work the way I'd like. Never mind, the window solution noted above is fine, and when I've learned some basic Blender, I'll be able to fake a sky texture on that. It'll be good enough.
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Sky outside / normal lighting inside?

Post by petri »

gambit37 wrote:Clearly Grimrock skies don't work the way I'd like. Never mind, the window solution noted above is fine, and when I've learned some basic Blender, I'll be able to fake a sky texture on that. It'll be good enough.
I don't think you need Blender to do that... You can simply override the material on the sky mesh with materialOverride property.
Post Reply