WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 12-04-2015, 03:13 PM
pitbool pitbool is offline
Member
 
Join Date: Oct 2012
Posts: 31
#
Code:
import viz
import vizfx

terrain = vizfx.addChild('blendTest.OSGB')
viz.go()

viz.MainView.setPosition([58.64860153198242, 0.0, -6.446604251861572])

algaeTexture = viz.addTexture('algae_texture3.jpg', type=viz.TEX_2D, wrap=viz.REPEAT)
# Create shader effect that blends textures and applies to diffuse color
code = """
Effect "Texture Blend" {

Float BlendAmount { value 0 }
Texture2D Texture1 { unit 0 }
Texture2D Texture2 { unit 1 }

Shader {

	BEGIN Material
	m.diffuse = mix( texture2D( Texture1, uvTexture1).rgb, texture2D( Texture2, uvTexture2).rgb, BlendAmount);
	END

}

}
"""
texBlendEffect = viz.addEffect(code)

itemFromTerrain = terrain.getChild('Terrain_Zone03')
oldTex = itemFromTerrain.getTexture()
itemFromTerrain.texture(oldTex)
itemFromTerrain.texture(algaeTexture, '', unit=1)
itemFromTerrain.apply(texBlendEffect)
itemFromTerrain.setUniformFloat('BlendAmount', 0.0)

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

def setBlendAmount2(blendRatioFromSlider):
	global itemFromTerrain
	itemFromTerrain.setUniformFloat('BlendAmount', blendRatioFromSlider)
vizact.onslider(slider, setBlendAmount2)

#

I couldn't find a Vizard resource to recreate this issue, so here is a link to download a zip of my shortest test py file with the terrain osgb and the algae jpg that I am trying to blend - https://stanford.box.com/s/5myna254j...5mkbkfmzdjug28.
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
Multiple Textures for Diffuse and Specularity Shader Issue shivanangel Vizard 1 05-11-2009 11:44 AM
Specular Shader Issue shivanangel Vizard 2 05-06-2009 12:08 PM


All times are GMT -7. The time now is 11:55 AM.


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