I seems to have trouble passing arrays to shader, all I get is black model, and not a single instance is showing, and I don’t know where is the problem.
Python code:
import os
import direct.directbase.DirectStart
from pandac.PandaModules import *
from panda3d.core import *
from direct.actor.Actor import Actor
INST_NUM = 50
MODEL = os.path.abspath("../models/mod.egg")
TEXTURE = os.path.abspath("../textures/text.png")
SHA_V = "../shaders/inst-sha-v.sha"
SHA_F = "../shaders/inst-sha-f.sha"
position = PTAVecBase4.emptyArray(INST_NUM)
for x in xrange(0, INST_NUM):
position[x] = Vec4(x*10, x*10, 0, 0)
model = Actor(MODEL)
model.setTexture(loader.loadTexture(TEXTURE))
model.setScale(5.0, 5.0, 5.0)
model.loop("idle01")
model.reparentTo(render)
shader = Shader.load(Shader.SLGLSL, SHA_V, SHA_F)
model.setShaderInput("upos", position)
model.setShader(shader)
model.setInstanceCount(INST_NUM)
run()
Passing arrays to shaders is not supported with GLSL.
You should not have a problem with using Cg, though. If you have “basic-shaders-only” set to “#f”, usually the shader is internally translated to GLSL anyway. So I advise using Cg instead.
It is a common misconception that Cg is not supported on ATI cards. Cg is internally translated to other shader languages internally, so it should work on any card.
I didn’t say that. There is either a bug in Panda3D, Cg or in your video card driver.
But first, make sure that “basic-shaders-only” is really set to “#f” and to be sure, put “//Cg profile glslv glslf” in your shader and set “notify-level-gobj debug” and give us the output.
oopsi, sorry maybe i miss interpreted your statement.
yes i did this already (without //cg just //profile…), its still using the default profile:
if the driver have a bug, then i do have really a problem. i think this was the latest release from amd. and this one is a bout a year old. so i dont think there will be a newer release coming.
…i will search for some alternative drivers today. (wish me luck…)
thanks anyhow for your answer…
oh one thing, is this correct how i try to receive the vertex coordinaten?
//Cg
//
void vshader(float4 vtx_position : POSITION,
//float vtx_othermodel : POSTION, //thats not working
float vtx_othermodel, //all values at zero
in uniform float4x4 mat_modelproj,
out float4 l_pos : POSITION)
{
l_pos = mul(mat_modelproj, vtx_position);
//l_pos1 = mul(mat_modelproj, vtx_othermodel); //
}
void fshader
(
out float4 o_color: COLOR)
{o_color = float4(1,0,0,1);}
I agree with this poster.
I had my basic shaders set to false, and had profile in //Cg, yet it will still fail on InstanceID semantics with the error posted above.
And array passed to GLSL will be empty, for some weird reason.
i had in mind to do a realtime 3d motion blur. a nice lighting and some other cool stuff…
a graphics engine is exactly what i need. the other stuff like sound, collisions, pyhsics ,… are for sure already implemented or anybody already cared in ogre about.
xna isnt a engine i know, but lot of classes are already written to use it without much of work like a engine. and here the similar statement, someone already cared about the most things… (a friend of mine, is writting a engine on xna)
im only in need to work on something without getting everytime into a situation where i have to wait till it got fixed. or using workarounds which are mostly not that much smooth, like the basic way was.
Panda3D is advanced enough- it supports the feature you require. Just because you are having a difficulty with it (or there may be a bug), doesn’t mean the engine is not advanced enough. You misspelled “basic-shaders-only”, by the way.
I wasn’t able to get the hardware instancing working on an ATI card with a CG shader either. Though if you don’t mind compiling your own build, you will find that the source code provided in this thread (8th post) will allow you to send array inputs to a GLSL shader, which works on an ATI card.
sorry i misspelled there nothing, i was just setting the existing call (basic-shader-only)or called short basic shaders, which is already in the config file, to false (#f i also tried it with zero (0)).
its not, just because i dont get this thing to run on a ati, means that it runs in regular on a nvidia card.
i only can say it doesnt work for me. so i cant do state of the art things with this engine, which means the engine is not advanced enough. (and this engine is not for free, if im going to download now any sources code, i have to spend money for the traffic, ok you dont receive any money. but it costs money for me)
peace
just get this pipe smoothly (without any workarounds) to work on ati graphics cards and i will be back.