HomePortalFAQSearchMemberlistUsergroupsRegisterLog in
Making threads to link to banned members content grants an automatic ban
Meet the new KITO admins & hear their plans here.
You can use google search to find threads and posts here now. Example

Share | 
 

 Dual eye colors

View previous topic View next topic Go down 
Go to page : 1, 2  Next
AuthorMessage
Hamilton

avatar

Game username : Hamilton
Server : Myatar Legends // Dragon's Den
Female Posts : 375
Join date : 2011-10-20
Age : 31
Location : everywhere

PostSubject: Dual eye colors   Sat Feb 28, 2015 7:09 pm

Step1: close down your server and delete all the old characters. don't be stingy about this. if you don't clean out the old characters before you set this up, you are going to crash a lot of people (ie everyone who tries to play with an established account) This change is going to effect the character data. and anytime to change the character data, you MUST clean out all the old data. This will be my second or third time i've had to clean out old data. It's tedious but nessecary. So, i DO recommend if you want new character features to always make that decision BEFORE you release your game if you want to avoid cleaning out masses of data.

Step2: listen to hammy and do not follow anything hammy posted in the support section. that post and info was bad, and hammy does feel very bad for it. this is the post that matters. live it, learn it, love it~

Step 3: set up your non-code based stuff first. You don't -have- to do it this way, but on a personal level, i like to get this kinda stuff done first.

The files you want to change are:

magixmod1.material (or whichever one you have your eyes code in)
magixmod.program
magixPS.cg (this one's in the programs folder)

the changes to your material should simply be the same as if you were adding a new mask into your terrain...with a little extra.

Quote :
material EyeModColour1
{
receive_shadows on
technique 1
{
pass
{
emissive 1 1 1 1
cull_hardware none
cull_software none
fragment_program_ref EyeModColour_PS
{
param_named_auto colorMod1 custom 1
param_named_auto colorMod2 custom 2
param_named_auto colorMod3 custom 3
}
texture_unit
{
texture eyeTex.jpg
tex_coord_set 0
}
texture_unit
{
texture eyeMask1.png
tex_coord_set 1
}
texture_unit
{
texture eyeRMask2.png
tex_coord_set 2
}
texture_unit
{
texture eyeLMask2.png
tex_coord_set 3
}

}
pass
{
scene_blend add
cull_hardware none
cull_software none
emissive 1 1 1
texture_unit
{
texture world.png
}
}
}
technique 2
{
pass
{
lighting off
texture_unit
{
texture eyeTex.jpg
}
cull_hardware none
cull_software none
}
pass
{
lighting off
scene_blend alpha_blend
depth_func equal
texture_unit
{
texture eyeMask1.png
alpha_op_ex source1 src_texture src_texture
colour_op_ex source2 src_texture src_texture
}
texture_unit
{
colour_op_ex blend_diffuse_alpha src_manual src_current 1 1 1 1
}
cull_hardware none
cull_software none
}
pass
{
lighting off
scene_blend alpha_blend
depth_func equal
texture_unit
{
texture eyeRMask2.png
alpha_op_ex source1 src_texture src_texture
colour_op_ex source2 src_texture src_texture
}
texture_unit
{
colour_op_ex blend_diffuse_alpha src_manual src_current 1 1 1 1
}
cull_hardware none
cull_software none
}
{
lighting off
scene_blend alpha_blend
depth_func equal
texture_unit
{
texture eyeLMask2.png
alpha_op_ex source1 src_texture src_texture
colour_op_ex source2 src_texture src_texture
}
texture_unit
{
colour_op_ex blend_diffuse_alpha src_manual src_current 1 1 1 1
}
cull_hardware none
cull_software none
}

pass
{
ambient 1.000000 1.000000 1.000000 1.000000
diffuse 1.000000 1.000000 1.000000 1.000000
specular 0.010000 0.010000 0.010000 1.000000
emissive 0.000000 0.000000 0.000000 1.000000
depth_func equal
        scene_blend zero src_colour
}
}
}

note that i also highlighted the texture files for mask2. you will need to create 2 new masks using the old mask. just duplicate it, name it properly, and then erase the left eye from one, and the right eye from the other. easy~

the next change is in the program file

Quote :
fragment_program EyeModColour_PS cg
{
source MagixPS.cg

entry_point eye_tex_mod

profiles ps_2_0 arbfp1

default_params
{
param_named colorMod1 float4 1 0 0 1
param_named colorMod2 float4 0 1 0 1
param_named colorMod3 float4 0 0 1 1
}
}

easy peasy.

last one, the cg file located in the programs -folder-

Quote :
void eye_tex_mod(
float2 uv : TEXCOORD0,

out float4 color : COLOR,

uniform float4 colorMod1,
uniform float4 colorMod2,
uniform float4 colorMod3,

uniform sampler2D eyeTex : register(s0),
uniform sampler2D alpha1 : register(s1),
uniform sampler2D alpha2 : register(s2),
uniform sampler2D alpha3 : register(s3))

{
float alphaMask1 = tex2D(alpha1, uv).a;
float alphaMask2 = tex2D(alpha2, uv).a;
float alphaMask3 = tex2D(alpha3, uv).a;
float3 textureValue1 = tex2D(eyeTex, uv).rgb;
float3 textureValue2 = colorMod1.rgb;
float3 textureValue3 = colorMod2.rgb;
float3 textureValue4 = colorMod3.rgb;

float3 blendValue = lerp(textureValue1, textureValue2, alphaMask1);
blendValue = lerp(blendValue, textureValue3, alphaMask2);
blendValue = lerp(blendValue, textureValue4, alphaMask3);
color = float4(blendValue,1);
}

save everything if you haven't already.

Step4? i already lost count.

time to make changes to the base code.

this get's a little tricky. just do what i did Very Happy (no not the first time in that bad post did you not listen to me before we started?!)

in MagixUnit

Quote :
tMat = MaterialManager::getSingleton().getByName("DynamicEyeMat"+StringConverter::toString(unitID));
static_cast<MaterialPtr>(MaterialManager::getSingleton().getByName("EyeModColour"+tHeadMat))->clone("DynamicEyeMat"+StringConverter::toString(unitID));
mHeadEnt->getSubEntity(2)->setMaterialName("DynamicEyeMat"+StringConverter::toString(unitID));
mHeadEnt->getSubEntity(2)->getTechnique()->getPass(1)->getTextureUnitState(1)->setColourOperationEx(LayerBlendOperationEx::LBX_BLEND_DIFFUSE_ALPHA,
LayerBlendSource::LBS_MANUAL,
LayerBlendSource::LBS_CURRENT,
ColourValue(eyeTopVect.x,
eyeTopVect.y,
eyeTopVect.z));
mHeadEnt->getSubEntity(2)->getTechnique()->getPass(2)->getTextureUnitState(1)->setColourOperationEx(LayerBlendOperationEx::LBX_BLEND_DIFFUSE_ALPHA,
LayerBlendSource::LBS_MANUAL,
LayerBlendSource::LBS_CURRENT,
ColourValue(eyeLVect.x,
eyeLVect.y,
eyeLVect.z));
mHeadEnt->getSubEntity(2)->getTechnique()->getPass(3)->getTextureUnitState(2)->setColourOperationEx(LayerBlendOperationEx::LBX_BLEND_DIFFUSE_ALPHA,
LayerBlendSource::LBS_MANUAL,
LayerBlendSource::LBS_CURRENT,
ColourValue(eyeRVect.x,
eyeRVect.y,
eyeRVect.z));

Quote :
const Vector4 eyeL = mHeadEnt->getSubEntity(2)->getCustomParameter(2);
const Vector4 eyeR = mHeadEnt->getSubEntity(2)->getCustomParameter(3);

Quote :
vect4ToString(eyeL,3) + ";" +
vect4ToString(eyeR,3) + ";" +

Quote :
const ColourValue &eyeL, const ColourValue &eyeR

Quote :
const Vector4 eyeLVect(eyeL.r,eyeL.g,eyeL.b,1);
const Vector4 eyeRVect(eyeR.r,eyeR.g,eyeR.b,1);
Quote :
mHeadEnt->getSubEntity(2)->setCustomParameter(2,eyeLVect); //eye Left
mHeadEnt->getSubEntity(2)->setCustomParameter(3,eyeRVect); //eye Right

up the counts here by 1 (mine are different, don't copy mine your build will fail)
Quote :
vector<String>::type tParam = StringUtil::split(colourString,";",18);
if(tParam.size()==16 || tParam.size()==17 || tParam.size()==18)
{
setColours(StringConverter::parseColourValue(tParam[0]),
StringConverter::parseColourValue(tParam[1]),
and tag an extra
Quote :
StringConverter::parseColourValue(tParam[7)),
to the end of the list (er not exactly like this, just keep the numbers in order.)


in MagixCharScreenManager

Quote :
"EyeL","EyeR"

increase this
Quote :
MAX_COLOURS
by 1

add in the new color value (my counts are different from yours. adjust for YOUR numbers)
Quote :
colourVal[9] = ColourValue(0.55,0.3,0.15); //Eye Left
colourVal[10] = ColourValue(0.55,0.3,0.15); //Eye Right
*make sure you adjust all the numbers AFTER the new value

these numbers also must be changed. everytime you add colors, you need to increase the numbers. ESP if you shoe horn them into the middle like we've done with the new eye color
Quote :
}while(colourPartID==11 && wingID==0 || colourPartID==3 && maneID==0&&tuftID==0 ||

you should have a list like this for EACH custom/edit page that the code defines. personally, i have 4. if you have my body-selection code, you will also have 4. add a new value to the very end of the list.
Quote :
mUnit->setColours(colourVal[0],colourVal[1],colourVal[2]

in MagixCampaignManager

you need to add a second black eye to the shadows because for some reason if the shadows don't match up, the build will fail.
Quote :
shadow->setColours(ColourValue(0,0,0)
just tag it to the end. duplicate one other the other 0,0,0 codes in the list. no biggie.

the same for this section
Quote :
{
const vector<String>::type tPart = StringUtil::split(cEvent[i].second,",",15);
if(tPart.size()>=14)
{
MagixUnit *unit = parseUnit(tPart[0]);
if(unit)unit->setColours(StringConverter::pars
again, my counts are WAY different because ML has more option in the creation process. just up all the counts by 1 and shoe-horn a new value in this line
Quote :
StringConverter::parseColourValue(tPart[4]),StringConverter::parseColourValue(tPart[5]),StringConverter::parseColourValue(tPart[6]),
StringConverter::parseColourValue(tPart[7]),StringConverter::parseColourValue(tPart[8]),StringConverter::parseColourValue(tPart[9]),



And...that should just about cover it. As long as you remembered to make those new mask images, you should be ready to go.

Build the game and then go test it out. Lemme know how it worked out for yah ;3



REMINDER! THIS CHANGES CHARACTER DATA AND ANY OLD CHARACTERS WILL CAUSE THE GAME TO CRASH! YOU MUST DELETE ALL THE OLD CHARACTER DATA BEFORE RUNNING THE GAME OR ISSUING A DOWNLOAD FOR YOUR PLAYERS!


Back to top Go down
-INACTIVE-
Texture Artist
Texture Artist


Male Posts : 447
Join date : 2014-05-03

PostSubject: Re: Dual eye colors   Sat Feb 28, 2015 7:38 pm

Thank you for nice tutorial (:


Last edited by Sly ßlack♥ on Mon May 25, 2015 7:40 am; edited 1 time in total
Back to top Go down
Hyper
Admin
avatar

Game username : Hyper
Server : Azoptaos
Male Posts : 483
Join date : 2014-02-09
Age : 19

PostSubject: Re: Dual eye colors   Sat Feb 28, 2015 9:34 pm

You can also modify the character files yourself, but this is a looot more work, especially depending on your server size. Azop has done it with nearly every update. It's messy and there are mistakes, but. I dunno, lol, we can't seem to stop adding new color options :B

Thank you for this Hamilton, very helpful.

________________________________
Back to top Go down
http://azoptaos.boards.net/
ShadoWolfozo

avatar

Game username : ShadoWolfozo
Server : GROWL: Spirits
Male Posts : 875
Join date : 2012-01-22
Age : 21
Location : Australia

PostSubject: Re: Dual eye colors   Sun Mar 01, 2015 11:31 am

I've implemented it and it isn't crashing, which is a good thing, but the eyes are a lovely shade of textureless blue and the 'Eyes' option still comes up instead of EyeL & EyeR in character creation despite;

Code:
const String tPart[MAX_COLOURS] = {"Pelt","Underfur","Mane","Nose","Above Eyes","Below Eyes","Ears","Tailtip","EyeL","EyeR","Wings","BodyMarkings","HeadMarkings","TailMarkings"};

Help?

Back to top Go down
Hyper
Admin
avatar

Game username : Hyper
Server : Azoptaos
Male Posts : 483
Join date : 2014-02-09
Age : 19

PostSubject: Re: Dual eye colors   Sun Mar 01, 2015 8:05 pm

where you added this:

Code:
vect4ToString(eyeL,3) + ";" +
vect4ToString(eyeR,3) + ";" +

they need to be in the same order as you have them listed in the tPart Colours string you posted. So you'd paste that in after tailtip

I pretty much just make sure everything is in the same order, since I've broken it many a time by changing it up

________________________________
Back to top Go down
http://azoptaos.boards.net/
ShadoWolfozo

avatar

Game username : ShadoWolfozo
Server : GROWL: Spirits
Male Posts : 875
Join date : 2012-01-22
Age : 21
Location : Australia

PostSubject: Re: Dual eye colors   Mon Mar 02, 2015 2:36 am

Code:
vect4ToString(tailtip,3) + ";" +
vect4ToString(eyeL,3) + ";" +
vect4ToString(eyeR,3) + ";" +

They already are :/
Back to top Go down
GlaciaTheWolf
®
®
avatar

Game username : Glacia, GlaciaIceWolf, GlaciaTheWolf
Server : Canis lupus (Owner/creator) DD (member)
Female Posts : 977
Join date : 2013-12-09
Age : 21
Location : Ohio

PostSubject: Re: Dual eye colors   Mon Mar 02, 2015 4:40 pm

My game crashed when i click create a character.

I fallowed your steps..and i even deleted my old account and made a new one for myself.
Back to top Go down
Hyper
Admin
avatar

Game username : Hyper
Server : Azoptaos
Male Posts : 483
Join date : 2014-02-09
Age : 19

PostSubject: Re: Dual eye colors   Mon Mar 02, 2015 10:40 pm

Alright, added it to my source as a test

If you're getting white eyes, pay attention to your material changes - Hammy has world.png whereas I have EyeShaded.png

if you're crashing, ogrelog is your friend!

However despite a few material messups, I got it to work

Spoiler:
 

Also if "Eyes" is showing instead of the new options, you've gotta be on the wrong exe?

________________________________
Back to top Go down
http://azoptaos.boards.net/
GlaciaTheWolf
®
®
avatar

Game username : Glacia, GlaciaIceWolf, GlaciaTheWolf
Server : Canis lupus (Owner/creator) DD (member)
Female Posts : 977
Join date : 2013-12-09
Age : 21
Location : Ohio

PostSubject: Re: Dual eye colors   Tue Mar 03, 2015 12:02 am

This is what my ogre log says at the bottom

Pass 0: Fragment program EyeModColour_PS cannot be used - compile error.
Back to top Go down
ShadoWolfozo

avatar

Game username : ShadoWolfozo
Server : GROWL: Spirits
Male Posts : 875
Join date : 2012-01-22
Age : 21
Location : Australia

PostSubject: Re: Dual eye colors   Tue Mar 03, 2015 8:08 am

Reminder that Hammy's compile is different to many others and you must be aware of this when modifying your files. Certain file names may be different, for example.

EDIT: I got the EyeL/R to work (I don't know how, all I did was re-compile again but I didn't change anything O_o )

still having the blue eyes bug and can't seem to find why.
basically the whole eye mesh is blue :/ Any suggestions?
I tried looking for spelling errors and found none.
Back to top Go down
GlaciaTheWolf
®
®
avatar

Game username : Glacia, GlaciaIceWolf, GlaciaTheWolf
Server : Canis lupus (Owner/creator) DD (member)
Female Posts : 977
Join date : 2013-12-09
Age : 21
Location : Ohio

PostSubject: Re: Dual eye colors   Tue Mar 03, 2015 3:58 pm

I know his compile is different. I think it has something to do with my magix mod material file
Back to top Go down
Hyper
Admin
avatar

Game username : Hyper
Server : Azoptaos
Male Posts : 483
Join date : 2014-02-09
Age : 19

PostSubject: Re: Dual eye colors   Tue Mar 03, 2015 10:02 pm

Did you check the ogrelog to see that your materials are all loading correctly Shad?

________________________________
Back to top Go down
http://azoptaos.boards.net/
ShadoWolfozo

avatar

Game username : ShadoWolfozo
Server : GROWL: Spirits
Male Posts : 875
Join date : 2012-01-22
Age : 21
Location : Australia

PostSubject: Re: Dual eye colors   Thu Mar 05, 2015 2:37 am

It appears it's only loading EyeRMask2.png and not the second one. I probably did something wrong in material file- when I get on my normal computer I'll have a play see if I can find what I did wrong.
Back to top Go down
ShadoWolfozo

avatar

Game username : ShadoWolfozo
Server : GROWL: Spirits
Male Posts : 875
Join date : 2012-01-22
Age : 21
Location : Australia

PostSubject: Re: Dual eye colors   Sat Mar 28, 2015 4:39 am



OgreLog is not reporting that the EyeR/L Mask is loading at all now.

What am I doing wrong? I've gone through all the files multiple times looking for everything from spelling mistakes to simply being in the wrong files. Help?
Back to top Go down
Hyper
Admin
avatar

Game username : Hyper
Server : Azoptaos
Male Posts : 483
Join date : 2014-02-09
Age : 19

PostSubject: Re: Dual eye colors   Sat Mar 28, 2015 4:54 am

I... I would honestly start over if I were you, haha. If none of the eye textures are loading it's probably something in MagixUnit's materials?

________________________________
Back to top Go down
http://azoptaos.boards.net/
ShadoWolfozo

avatar

Game username : ShadoWolfozo
Server : GROWL: Spirits
Male Posts : 875
Join date : 2012-01-22
Age : 21
Location : Australia

PostSubject: Re: Dual eye colors   Sun Mar 29, 2015 8:50 am

so um

everyone can uh forget my errors
i uh
realised
i did something really stupid and forgot something to do with where my game files are Smile

So... it's all fixed lol Smile


Back to top Go down
chevy_cheetah

avatar

Game username : chevy_cheetah(chevrolet)
Server : |~|N/A |~| Skills: Hosting, Modeling, Rigging. Age:19
Female Posts : 284
Join date : 2015-02-15
Location : Everywhere.

PostSubject: Re: Dual eye colors   Sun Mar 29, 2015 4:34 pm

Hi, I tried to place this code in the body selector source, but it still ends up having 1 fail for me. I tried re doing it as well. Please help me.
Back to top Go down
Nefadozone

avatar

Game username : Nefadozone
Server : Fucko McShitpo
Male Posts : 176
Join date : 2011-11-11
Age : 23
Location : Satan's Asshole

PostSubject: Re: Dual eye colors   Mon Mar 30, 2015 7:48 am

Thank you so much for this! This helped me finally add underfur to the tail, and is pointing me in the right direction of a second marking layer.
Back to top Go down
http://wildmidnight.boards.net/
angelluvpup345

avatar

Game username : FurryYinYangz
Server : Planet MarlaCo
Female Posts : 12
Join date : 2014-04-26
Age : 15
Location : your face

PostSubject: Re: Dual eye colors   Fri May 08, 2015 12:39 am

_Nearly got this correct so i just use the two masks from the textures file? or one of them?X

scratch that do i make 4 mask for both and name the two MaskL and mask R or the name them normally??
Back to top Go down
Alex912

avatar

Game username : Alex912
Female Posts : 87
Join date : 2014-10-15
Age : 20
Location : Croatia

PostSubject: Re: Dual eye colors   Sat May 16, 2015 12:48 pm

I'm stuck at this part:

you need to add a second black eye to the shadows because for some reason if the shadows don't match up, the build will fail.
Code:
shadow->setColours(ColourValue(0,0,0)
just tag it to the end. duplicate one other the other 0,0,0 codes in the list. no biggie.

the same for this section
Code:
{
const vector<String>::type tPart = StringUtil::split(cEvent[i].second,",",15);
if(tPart.size()>=14)
{
MagixUnit *unit = parseUnit(tPart[0]);
if(unit)unit->setColours(StringConverter::pars

Help please? I don't really understand what to do. xD
Back to top Go down
Wolfess

avatar

Game username : Wolfess
Server : CoA, GoD
Female Posts : 75
Join date : 2011-10-26
Age : 27
Location : PTZ

PostSubject: Re: Dual eye colors   Sat May 23, 2015 12:40 pm

Hmmm this is quite handy, though I have quite strange exeption while building some tests for ChoA. I got the blank KITO sourses, and made changes (well including all above) in MAX_COLOURS up to 12 (just in case for I will add more with time anyway). But the thing different is I got an entire new entity for the head mesh for the right eye, and yes it is supported in the model itself, but everything else is basically the same. Now the question is, how come the function is overladed?

Code:
107 IntelliSense: no instance of overloaded function "MagixUnit::setColours" matches the specified type c:\1\kito\src\client\src\MagixUnit.cpp 250 17 game
Wonder how that worked before anyway...
Back to top Go down
RedEye
Retired
avatar

Game username : -redeye-
Server : KITO
Male Posts : 2575
Join date : 2011-07-24
Age : 30

PostSubject: Re: Dual eye colors   Sat May 23, 2015 5:01 pm

Open include\MagixUnit.h and find the function there as well.

Think of .h files as the specification and .cpp files as the code. The spec must match the code

________________________________
Retired
Back to top Go down
Witacha
3D Modeler
3D Modeler
avatar

Game username : Witacha
Server : Land Of The Wolves(Owner)
Female Posts : 1198
Join date : 2012-06-15
Age : 18
Location : France

PostSubject: Re: Dual eye colors   Sun May 24, 2015 9:24 pm

Alright  i tried my best but i got 1 failed and i'm very confused ^^"
Spoiler:
 
There's some part of the tutorial where i'm not sure what I should do.
Back to top Go down
http://witacha-asukata.deviantart.com/
Wolfess

avatar

Game username : Wolfess
Server : CoA, GoD
Female Posts : 75
Join date : 2011-10-26
Age : 27
Location : PTZ

PostSubject: Re: Dual eye colors   Tue May 26, 2015 7:46 am

-solved- nevermind. but now the problem with entities still stands. Maybe I'll solve it too...someday...XD
Back to top Go down
Skyia

avatar

Game username : Skyia
Server : Royal Elements
Female Posts : 144
Join date : 2014-09-14
Age : 16
Location : In your mind

PostSubject: Re: Dual eye colors   Wed Jun 24, 2015 11:57 pm

I tried and need help. Im really confused now. (Sorry I know this thread is a few months old)
Spoiler:
 
Back to top Go down
 
Dual eye colors
View previous topic View next topic Back to top 
Page 1 of 2Go to page : 1, 2  Next

Permissions in this forum:You cannot reply to topics in this forum
Keeping I.T. Open :: DOWNLOADABLE CONTENT :: Programming Features-
Jump to: