Custom Light

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!
Post Reply
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Custom Light

Post by Emera Nova »

Which .lua file is needed to be edited to create your own light sources of different intensities and colours? Looking around the assests folder and I thought I found it but when I edited one of the files nothing ended up happening.
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Re: Custom Light

Post by Emera Nova »

I managed to find the files needed to change the colours of the lights and what not but now I'm stuck on a different problem. I'm wanting to make the healing crystal match the colour of the area that it's in. I can change the light it gives off and the fog but the model itself doesn't seem to ever change from blue. Any ways around this?
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Custom Light

Post by bongobeat »

I guess you have to use a different material if you want something different than blue.

actually, the healing crystal use "textures/env/healing_crystal_dif" as diffuse texture, so he will never change colour.

but you can try this with less ressource:
make a new crystal model that use a copy of the crystal material definition.

e.g:
SpoilerShow

Code: Select all

defineMaterial{
	name = "my_new_healing_crystal",
	diffuseMap = "assets/textures/env/healing_crystal_dif.tga",
	specularMap = "assets/textures/env/healing_crystal_dif.tga",
	normalMap = "assets/textures/env/healing_crystal_normal.tga",
	doubleSided = false,
	lighting = true,
	ambientOcclusion = false,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 20,
	depthBias = 0,
	
	-- custom shader
	shader = "crystal",
	shadeTex = "assets/textures/env/healing_crystal_shadetex.tga",
	shadeTexAngle = 0,
	crystalIntensity = 3,
	onUpdate = function(self, time)
		self:setParam("shadeTexAngle", time*0.8)
	end,
}
make a 8x8 dds texture or more of the color you want (like the black one, assets/textures/common/black.tga"),
then add this line to the material definition of the healing crystal:
SpoilerShow

Code: Select all

	emissiveMap = "mod_assets/textures/my_colored_texture.tga",
not sure if this is the best way, but, depending the color, you can have a mix of the 1st diffuse texture and the new one. Just try if the effect is good.

if not, then you will need to make a new texture for the crystal.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Custom Light

Post by minmay »

Use ModelComponent's emissiveColor field instead of making single-color emissive maps. Note that green and red versions of the healing crystal shadeTex already exist: green_slime_shadetex.dds and red_gem_shadetex.dds if I recall correctly. I don't think you'll be able to get a really good-looking color change without making a different diffuse map, though. Unless you count inverting the colours of the entire world by setting the sky's tonemap saturation to -1 :P
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.
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Custom Light

Post by bongobeat »

this can be very fun! :D
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
Post Reply