WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-30-2015, 04:39 PM
tokola tokola is offline
Member
 
Join Date: Nov 2012
Posts: 67
Still problems with texture replace or multi-texture

Any update on this?
I am also trying to apply a texture on another node that has a material pre-assigned in 3DS. No matter what image I use as a texture, only the color of the texture is applied and the actual texture is totally ignored. I am using again the "appearance" property with TEXREPLACE, but has no effect besides getting rid of the pre-exiting material.

I include my attempt. It shouldn't be that hard, but it doesn't work as the multi-texture example in the documentation with the Worldviz logo. What am I missing here?

Thanks.
Attached Files
File Type: zip replace-texture.zip (9.2 KB, 2181 views)
Reply With Quote
  #2  
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
Reply

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
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 10:23 PM.


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