![]() |
#1
|
|||
|
|||
Npr
Hi all, as part of a final yr project for my degree i want to produce a walk-through using non-photorealistic rendering techniques. I'm experimenting with a GLSL sketch-like shader produced using Mental Mill (i am not a programmer) using:
- toon2 = viz.addShader(vert='MySketch1_v.gl', frag = 'MySketch_f.gl') - - box2.apply(toon2) - but i get this error message: glLinkProgram "" FAILED Program "" infolog: Vertex info ----------- (20) : warning C7011: implicit cast from "vec4" to "vec3" (20) : warning C7011: implicit cast from "vec4" to "vec3" Fragment info ------------- (581) : warning C7011: implicit cast from "vec4" to "float" (581) : warning C7011: implicit cast from "float" to "vec4" (581) : error C3002: call to undefined function "saturate" I would be VERY grateful of ANY help at all with this as I feel like i've come to a grinding halt. (I have attached the vert and frag files converted to txt so that i could upload them) Regards Nige Last edited by nige777; 11-26-2007 at 08:32 AM. Reason: Attach shader files. |
#2
|
|||
|
|||
It seems like Mental Mill did not produce valid GLSL code. The warnings should not be a big deal. However, there is an error in the fragment shader. GLSL has no saturate function. Even without this error, you will still need to do a lot more to get the shader working. The vertex and fragment shaders depend on runtime uniforms, which you have not declared in your script. Your vertex shader requires the following uniforms:
Code:
uniform float flip_normal; Code:
// // The following are free parameters of the shader // that should be set by the application at runtime. // uniform vec4 msl_light0_color; uniform float msl_light0_intensity; uniform float msl_light0_distance_falloff_exponent; uniform float msl_light0_distance_falloff_start; uniform float msl_light0_distance_falloff_limit; uniform float msl_light0_distance_scale; uniform vec3 msl_light0_position; uniform sampler2D msl_Texture_lookup_2d_4_texture; uniform sampler2D msl_Texture_lookup_2d_3_texture; uniform sampler2D msl_Texture_lookup_2d_2_texture; uniform sampler2D msl_Texture_lookup_2d_1_texture; uniform float msl_Component_phong_1_specular_shininess; uniform vec4 msl_Generator_blend_ramp_1_colors[4]; uniform float msl_Layer_posterize_1_steps; uniform vec4 msl_Math_color_add_1_right; uniform float msl_Generator_outline_1_threshold; uniform vec4 msl_Generator_outline_1_line_color; uniform vec4 msl_Generator_outline_1_fill_color; |
#3
|
|||
|
|||
Npr
Thank you very much for your prompt reply, the Vizard forum is a wonderful resource for me
![]() ![]() Another (simpler, yet slightly less effective) option for me may be to use the supplied toon shader -couple of questions - is there a way of removing the modifier from an object once it has been added and is there a way of controlling the colour of an object with toon applied? Thanks for your patience ![]() |
#4
|
|||
|
|||
I've attached a script that shows how to dynamically add/remove the toon shader from a model and how to dynamically change its color. Let me know if anything is not clear:
Code:
import viz viz.go() #Set background color viz.clearcolor(viz.SKYBLUE) #Add toon modifier toon = viz.add('toon.dlm') #Create group node that has toon shader applied ToonGroup = viz.addGroup() ToonGroup.modify(toon) #Create a model and spin it right round baby right round model = viz.add('logo.wrl',pos=(0,1,5)) model.addAction(vizact.spin(0,1,0,90)) #Toggle models parent between ToonGroup and World when spacebar is pressed vizact.onkeydown(' ',model.parent,vizact.choice([ToonGroup,viz.WORLD])) #Toggle models color when 'c' key is pressed vizact.onkeydown('c',model.color,vizact.choice([viz.RED,viz.GREEN,viz.YELLOW,viz.BLUE,viz.GRAY])) |
#5
|
|||
|
|||
NPR _ Thanks
Thank you farshizzo, that code was great - i'm enjoying expanding my python vocabulary. I think this will be a good compromise until (if
![]() Thanks again |
#6
|
|||
|
|||
The OpenGL website has some links to GLSL tutorials. Here is a link to the page: http://www.opengl.org/code/category/C20
|
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|