Page 1 of 1

Custom Light

Posted: Tue Mar 31, 2015 3:24 pm
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.

Re: Custom Light

Posted: Tue Mar 31, 2015 5:50 pm
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?

Re: Custom Light

Posted: Tue Mar 31, 2015 7:29 pm
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.

Re: Custom Light

Posted: Tue Mar 31, 2015 9:22 pm
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

Re: Custom Light

Posted: Tue Mar 31, 2015 10:58 pm
by bongobeat
this can be very fun! :D