sidebar features
sidebar content

Go Back   Blender Artists Forums > Game Engine > Game Engine Support and Discussion

Reply
 
Thread Tools
Thorgal's Avatar
Thorgal Thorgal is offline
Member
 
Join Date: Sep 2003
Location: Brazsil
Posts: 568
http://www.dev.com.br/dimy/

Hello everyone!
Here is a new project: Mechdroid.
I hope you will enjoy it.
Gameplay is very, very simple.
My intention was to help people starting with the engine.

Comments and critics are wellcome!
Yours,

Ortiz

.BLEND FILE: http://www.dev.com.br/dimy/downloads...roidgame.blend




............................................
www.primotico.blogspot.com


Last edited by Thorgal; 26-Jun-07 at 14:24. Reason: added some screens
#1   Old 25-Jun-07, 03:42   
Reply With Quote


Yes's Avatar
Yes Yes is offline
Member
 
Join Date: Apr 2007
Posts: 127
Cool. I can't find the normal map script I used to have so thanks for adding the nice maps to your enviorment and character.
............................................
You goin disco?
#2   Old 25-Jun-07, 06:00   
Reply With Quote
Thorgal's Avatar
Thorgal Thorgal is offline
Member
 
Join Date: Sep 2003
Location: Brazsil
Posts: 568
Hey, thank you for your feedback Yes.

You should find the Blender Foundation script for normalmap inside my download area ("packed" onto, "mechdroidanimated.blend" and "mechdroidgame.blend" or inside Blender Foundation downloads for realtime.

It is just a two channel texture script

Now you can also use ctrlC and ctrlV from this post:

import GameLogic as g
objlist = g.getCurrentScene().getObjectList()
g.setLogicTicRate(60.0)
# -------------------------------------
ShaderObjects = [ objlist['OBmechdroid'] ]
MaterialIndexList = [0,1]
GlobalAmbient = [0.39,0.35,0.32,1]
AmbF = 0.5
# -------------------------------------

VertexShader = """
uniform mat4 mvi;
vec4 Tangent;

varying vec4 vcol;

varying vec3 lvec,vvec;

vec3 TBN(in vec3 by)
{
vec3 tangent = (Tangent.xyz);
vec3 binormal = cross(gl_Normal, Tangent.xyz)*Tangent.w;
vec3 normal = gl_Normal;

vec3 tvec;
tvec.x = dot(tangent, by);
tvec.y = dot(binormal, by);
tvec.z = dot(normal, by);
return tvec;
}

void main() {
gl_Position = ftransform();

// texcoord now (vec4())
Tangent = gl_MultiTexCoord1;

vec4 light0 = (mvi*gl_LightSource[0].position)-gl_Vertex;

vec4 view = mvi[3]-gl_Vertex;

lvec = TBN(light0.xyz);
vvec = TBN(view.xyz);

gl_TexCoord[0] = gl_MultiTexCoord0;

vcol =gl_Color;
}
"""

FragmentShader = """
varying vec4 vcol;
varying vec3 lvec,vvec,hvec;


uniform sampler2D color;
uniform sampler2D bump;

void main() {
vec4 diffuse_color = vcol*gl_LightSource[0].diffuse;
vec4 specular_color = gl_FrontMaterial.specular;
vec4 colormap = texture2D(color, gl_TexCoord[0].st);

vec3 lv = normalize(lvec);
vec3 vv = normalize(vvec);
vec3 nv = normalize(2.0*texture2D(bump, gl_TexCoord[0].st).xyz-1.0);

float diff = max(dot(lv, nv), 0.0);
float spec = pow(max(dot(reflect(-vv, nv), lv),0.0), gl_FrontMaterial.shininess);

vec4 diff_pass = colormap*(diff*diffuse_color);
vec4 spec_pass = spec*specular_color;
gl_FragColor = vec4(0.1,0.1,0.1,1.0)+diff_pass+spec_pass;
}
"""


def MainLoop ():
# for each object
for obj in ShaderObjects:

mesh_index = 0
mesh = obj.getMesh(mesh_index)

while mesh != None:

for mat in mesh.materials:

# regular TexFace materials do NOT have this function
if not hasattr(mat, "getMaterialIndex"):
return

mat_index = mat.getMaterialIndex()

# find an index
found = 0
for i in range(len(MaterialIndexList)):
if mat_index == MaterialIndexList[i]:
found=1
break
if not found: continue

shader = mat.getShader()
if shader != None:
if not shader.isValid():
shader.setSource(VertexShader, FragmentShader,1)


# shader.setAttrib(g.SHD_TANGENT)
shader.setUniformDef('mvi', g.MODELVIEWMATRIX_INVERSE)
shader.setSampler('color', 0)
shader.setSampler('bump', 1)

mesh_index += 1
mesh = obj.getMesh(mesh_index)

# -------------------------------------
MainLoop()
# -------------------------------------
............................................
www.primotico.blogspot.com


Last edited by Thorgal; 25-Jun-07 at 14:52.
#3   Old 25-Jun-07, 14:04   
Reply With Quote
Yes's Avatar
Yes Yes is offline
Member
 
Join Date: Apr 2007
Posts: 127
Thanks dood.
............................................
You goin disco?
#4   Old 25-Jun-07, 19:57   
Reply With Quote
Thorgal's Avatar
Thorgal Thorgal is offline
Member
 
Join Date: Sep 2003
Location: Brazsil
Posts: 568
You are welcome!

Have you also tried Piraniac's toon shader?

http://blenderartists.org/forum/showthread.php?t=97601


Its awesome!
............................................
www.primotico.blogspot.com

#5   Old 25-Jun-07, 21:19   
Reply With Quote
C-106 Delta's Avatar
C-106 Delta C-106 Delta is offline
Member
 
Join Date: Sep 2006
Posts: 1,259
Your game seems very good but my graphic card can't handle your graphics. Everything has inverted colors.
............................................

#6   Old 26-Jun-07, 00:13   
Reply With Quote
Thorgal's Avatar
Thorgal Thorgal is offline
Member
 
Join Date: Sep 2003
Location: Brazsil
Posts: 568
Hi C-106 Delta!

So sorry!

I guess your graphics card doesn't have open gl 2.0 support... But don't worry! Soon i will post another version able to work without GLSL

Right now you can turn off "use blender materials" inside the game menu bar. This will make Uv mapping work with just the main texture, not the normalmap thingie and colors will be better for you.

I hope it works...

Bye!
............................................
www.primotico.blogspot.com


Last edited by Thorgal; 27-Jun-07 at 21:16. Reason: grammar
#7   Old 26-Jun-07, 01:23   
Reply With Quote
Thorgal's Avatar
Thorgal Thorgal is offline
Member
 
Join Date: Sep 2003
Location: Brazsil
Posts: 568
added some screens
............................................
www.primotico.blogspot.com

#8   Old 26-Jun-07, 20:33   
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 18:37.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Logo and website design copyright © 2006 by froodee design bureau. All rights reserved.
Other Blender Sites
new icon Blender Homepage »
The official Blender homepage
new icon BlenderNation »
Fresh Blender News, Every Day
new icon Blenderart Magazine »
Blender articles, tutorials and images.
Blender Headlines
Featured Artwork
Short animation: Barrel by Phlopper
Woolly mammoth by sebastian_k
Photorealistic classic furniture by eMirage
Social BlenderArtists