HomePortalFAQSearchMemberlistUsergroupsRegisterLog in
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 : Previous  1, 2
AuthorMessage
Hamilton

avatar

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

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

First topic message reminder :

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

AuthorMessage
Skyia



Posts : 144
Join date : 2014-09-14

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
Skyia

avatar

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

PostSubject: Re: Dual eye colors   Sat Jun 27, 2015 3:22 am

Bump?
Back to top Go down
Claire
Very Helpful
Very Helpful
avatar

Game username : SoftMoon | MissDiealot
Server : Vaellerios (admin) | Lair of the Wolf (admin)
Female Posts : 328
Join date : 2015-03-03
Age : 16

PostSubject: Re: Dual eye colors   Sat Jun 27, 2015 10:54 am

Create a thread in the Support section.
Back to top Go down
http://missdiealot.deviantart.com/
Yeppermedepper

avatar

Posts : 25
Join date : 2014-11-28

PostSubject: Re: Dual eye colors   Mon Jul 06, 2015 11:16 pm

I bet this would work as an inner and outer iris color selector too!

you really did a great job!
Back to top Go down
VerserA

avatar

Game username : Allen (or VerserA)
Server : Impressive Space
Female Posts : 108
Join date : 2015-04-22
Age : 20
Location : Russia

PostSubject: Re: Dual eye colors   Sat Mar 26, 2016 8:56 am

Thanks Hamilton!
Back to top Go down
https://vk.com/allenverser
Slain Motionless

avatar

Game username : The-Hunted
Server : Aroessa
Female Posts : 431
Join date : 2014-05-09
Age : 18
Location : Coding

PostSubject: Re: Dual eye colors   Sun May 08, 2016 12:22 am

Giving you all a heads up when putting this in:

BOTH VERSIONS OF FILES NEED EDITING.
Aka, Unit.cpp and Unit.h is an example.

This is intended for 5.5 and lower, but 6.0 errors with just these edits. That above should fix it.
Back to top Go down
http://aroessa.proboards.com
Sponsored content




PostSubject: Re: Dual eye colors   

Back to top Go down
 
Dual eye colors
View previous topic View next topic Back to top 
Page 2 of 2Go to page : Previous  1, 2

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