Controlling texture shades

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.

Controlling texture shades

Postby Grogyan » Fri Apr 18, 2008 10:08 pm

Okay, okay, I just reminded myself that I wanted to get some idea of how to change the colour/shade of a texture on an object sequentially at the push of a button.

It was one of the ideas that I wanted to include in the contest but still havn't got round to it, mainly because coding of any sort with python hurts my head.

There are several states, gray, red, green, blue/yellow and white, which will form the basis of a puzzle.
The goal is that the texture will stay the same, but the shade/colour of the texture would change, any ideas would be very grateful on how to implement this without python or with little python coding.

I understand that some python is needed because of using SDL states, but this idea has really stumped me.
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: Controlling texture shades

Postby Grogyan » Mon Apr 21, 2008 10:55 pm

bump
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: Controlling texture shades

Postby Lontahv » Mon Apr 21, 2008 11:51 pm

Ok, this is what I'd do:

I'd either have a light that affects the object's color and then control the light's hue.

or

I'd have actually duplicates of each object(with different colors) and then hook them up to turn on and off.

If you're into python code(like I am), here's the code for making an object invis/vis:

Code: Select all
##Note:  You'll need to import Plasma and PlasmaTypes at the top of your file, here's the code:

from Plasma import *
from PlasmaTypes import *

##code to make object invisible

objName = "<your objectname>"
obj = PtFindSceneobject(objName, PtGetAgeName())
obj.draw.disable()

##code to make object visible


objName = "<your objectname>"
obj = PtFindSceneobject(objName, PtGetAgeName())
obj.draw.enable()



Ok, here's the code to make a lamp change color:

Code: Select all
lampName = "<Your lampname>"

r = 1.0

b = 1.0

g = 1.0

intensity = 1.0

obj = PtFindSceneobject(lampName, PtGetAgeName())
PtSetLightValue(obj.getKey(), r, g, b, intensity)




There we go. If you don't want to have to program in python, I can help a bit with the coding. Just PM me. :)


SDLs aren't really the meat of thing, mostly what they're used for is to save the state if you leave the age, I don't usually use them.

If you have a clickable puzzle, Python's mostly what's going to be running it.

There are some inside-the-prp non-python stuff you maybe could do, but the documentation is hard to find.

If anyone can think of a better way of doing what Grogyan wants his age to do, please post.



~Lontahv
Currently getting some ink on my hands over at the Guild Of Ink-Makers (PyPRP2).
User avatar
Lontahv
Councilor of Artistic Direction
 
Posts: 1331
Joined: Wed Oct 03, 2007 2:09 pm

Re: Controlling texture shades

Postby Grogyan » Tue Apr 22, 2008 2:45 am

I was thinking on the same lines today, that maybe the best way to go is making 4 copies of each mesh with different colours.
Don't open for casual reading as this spoiler can contain puzzle mechanics Show Spoiler


After reviewing what needs to be done, timers, counters, trigger regions, clickables, sound triggers, that its quite likely that i'll need help coding it in.
But the main thing that has been racking my brain is switching the colours of the texture on the crystals as opposed to having many copies of the same object
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: Controlling texture shades

Postby Lontahv » Tue Apr 22, 2008 2:38 pm

Hmm, let me do a little test with python and lights. :)

~Lontahv
Currently getting some ink on my hands over at the Guild Of Ink-Makers (PyPRP2).
User avatar
Lontahv
Councilor of Artistic Direction
 
Posts: 1331
Joined: Wed Oct 03, 2007 2:09 pm

Re: Controlling texture shades

Postby Grogyan » Tue Apr 22, 2008 11:49 pm

I have a few other fixes and additions before doing this hard bit.
Let me know how you get on ;)
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: Controlling texture shades

Postby Lontahv » Thu Apr 24, 2008 7:27 pm

Do you have the crystals in the age's blend? It's easier for me to download the blend, alter it, then send it back to you. Rather than having to make a tutorial, or a template.

If you're going to have multiple copies of the same crystal, do a bit of work on each of the states you want it in, then when you send me the blend, I can just program. And then alter the age to include click regions etc. and a .pak. :)

~Lontahv
Currently getting some ink on my hands over at the Guild Of Ink-Makers (PyPRP2).
User avatar
Lontahv
Councilor of Artistic Direction
 
Posts: 1331
Joined: Wed Oct 03, 2007 2:09 pm

Re: Controlling texture shades

Postby Grogyan » Thu Apr 24, 2008 10:16 pm

Wow thats great.

Yeah the crystals are in the .blend file, though i'm not to sure what you mean by states, as at this moment the best I can do is jot down all the states I need or I think i'll need, which I think I can do easily enough in SDL format

I have quite a bit of work to do yet, but i'll get onto it more this week if I can.

FYI, when I/we, finished the Age, I plan on submitting it for everyone to look at, recompile it etc from the .blend, with textures and sounds and scripts.

I feel as though I need to do this, as there really isn't a reference Age that takes a lot of things into account, especially with the recent features in the plug in.

I still havn't done any lighting yet, still something I have to work on.
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am


Return to Scripting

Who is online

Users browsing this forum: No registered users and 16 guests