WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 02-04-2016, 06:52 AM
rawphl rawphl is offline
Join Date: Feb 2016
Posts: 2
Standard Texture setup

How do you apply a standard texture setup (diffuse, normal, specular) to a model in vizard? I know GLSL so I could write a shader (although the vizard documentation is unclear on a lot of things, e.g. how is the uv attribute/varying called? Or is it using the old gl_TexCoord?)
but I'm sure this is already integrated.

Can I get a code example? I played around with vizfx.addMaterialEffect (which also isn't documented) but vizard would normally just use the diffuse texture and ignore the rest.

Thanks in advance.
Reply With Quote
Old 02-05-2016, 01:16 AM
Jeff Jeff is offline
WorldViz Team Member
Join Date: Aug 2008
Posts: 2,470
I'll check with a developer and get back to you.
Reply With Quote
Old 02-08-2016, 03:21 AM
rawphl rawphl is offline
Join Date: Feb 2016
Posts: 2
I think I got this to work:

import viz
import vizcam
import vizshape
import vizfx

from vizfx.effect.material import BaseMaterial, Diffuse, Specular, Bump


pivot_nav = vizcam.PivotNavigate()

light1 = vizfx.addDirectionalLight(euler = (45, 45, 0))
vizfx.setAmbientColor([0, 0, 0])

box = vizfx.addChild('basketball.osgb')

diffuse_map = viz.addTexture("pattern_66_diffuse.png") 
diffuse_map.wrap(viz.WRAP_T, viz.REPEAT)
diffuse_map.wrap(viz.WRAP_S, viz.REPEAT)
normal_map = viz.addTexture("pattern_66_normal.png")
normal_map.wrap(viz.WRAP_T, viz.REPEAT)
normal_map.wrap(viz.WRAP_S, viz.REPEAT)
specular_map = viz.addTexture("pattern_66_specular.png")
specular_map.wrap(viz.WRAP_T, viz.REPEAT)
specular_map.wrap(viz.WRAP_S, viz.REPEAT)
material = vizfx.addMaterialEffect(
    Diffuse(diffuse_map, 0), Bump(normal_map, 1), Specular(specular_map, 2)
The textures are too big to upload to the forum, but the gist should be clear, see screenshot for the result.

I would still like to know if this is the intended way to do it
Attached Thumbnails
Click image for larger version

Name:	standard_textures.jpg
Views:	473
Size:	149.4 KB
ID:	759  
Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Texture Coordinate Generation (TexGen) using Shader goro Vizard 1 05-31-2013 01:44 AM
How to render a texture of the transparent object and then blur it whj Vizard 1 09-25-2012 03:15 PM
Avatar texture swaping sleiN13 Vizard 5 06-24-2011 12:48 AM
How to apply shader and render texture to an object whj Vizard 0 04-23-2010 12:23 PM
Randomly and Continuously Change Avatar's Face Texture Karla Vizard 4 08-22-2008 12:14 PM

All times are GMT -7. The time now is 02:48 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2022, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC