WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 07-01-2015, 06:51 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
For the first question, you could use a shader to multiply a blend value with the transparent texture and add that to the base texture. Here's an example:

Code:
import viz
viz.go()

viz.addChild('piazza.osgb')

quad = viz.addTexQuad(pos=[0,1.8,5])
texture = viz.addTexture('images/tile_grass.jpg')
texture2 = viz.addTexture('crosshair.png')
quad.texture(texture)
quad.texture(texture2,unit=1)

frag = """
uniform sampler2D map1;
uniform sampler2D map2;
uniform float blend;
void main()
{
	vec4 clr1 = texture2D(map1,gl_TexCoord[0].st);
	vec4 clr2 = texture2D(map2,gl_TexCoord[0].st);
	gl_FragColor = clr1+clr2*blend;
}
"""
shader = viz.addShader(frag=frag)
shader.attach(viz.addUniformInt('map1',0))
shader.attach(viz.addUniformInt('map2',1))
blend = viz.addUniformFloat('blend',0.0)
shader.attach(blend)
quad.apply(shader)

slider = viz.addSlider(pos=(0.5,0.1,0))
slider.set(0)

import vizact
vizact.onslider(slider,blend.set)
Please create a new thread for the second question for further assistance. The model does not seems to have texture coordinates.
Reply With Quote
 


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
OSG Exporter - Texture seams somehow have alpha JvdBosch Vizard 12 01-03-2013 04:02 PM
How to render a texture of the transparent object and then blur it whj Vizard 1 09-25-2012 04:15 PM
Avatar texture swaping sleiN13 Vizard 5 06-24-2011 01:48 AM
How to apply shader and render texture to an object whj Vizard 0 04-23-2010 01:23 PM
Translating a texture and its Alpha shivanangel Vizard 5 12-02-2008 05:52 PM


All times are GMT -7. The time now is 06:47 PM.


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