OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

EXTERNAL: Re: Value of a variable in shaders?


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Rowley, Marlin R
Guest





PostPosted: Fri Sep 28, 2018 1:39 pm    Post subject:
EXTERNAL: Re: Value of a variable in shaders?
Reply with quote

Robert,

I’ve written the shaders already and am well-versed in writing them. I just need a debugging tool that will allow me to see their values at runtime.

----------------------------------------
Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)

From: osg-users <> On Behalf Of Robert Osfield
Sent: Friday, September 28, 2018 1:40 AM
To: OpenSceneGraph Users <>
Subject: EXTERNAL: Re: Value of a variable in shaders?

Hi Marlin,
On Thu, 27 Sep 2018 at 19:30, Rowley, Marlin R < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:

Is there a way to examine variable values in shader code? I can’t figure out this problem that we are having unless I can see the values in the shaders.




To pass data into shaders you have use a combination of uniforms (osg::Unfiorm), textures (osg::Textre*) and vertex attributes. With recent 3.4.x onwards you also have the option of passing in constants via #prama(tic) shader composition system that passes #define values into the compilation of shaders.



Shaders are a big topic so it's impossible for me to give you a full guide, there are plenty of reosurces online about GLSL shaders, within the OSG search for uses of osg::Program, osg::Shader, osg::Uniform.



Robert.

------------------
Post generated by Mail2Forum
Back to top
Rowley, Marlin R
Guest





PostPosted: Fri Sep 28, 2018 1:43 pm    Post subject:
EXTERNAL: Re: Value of a variable in shaders?
Reply with quote

Thanks, I'll look into that.

----------------------------------------
Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)


-----Original Message-----
From: Sebastian Messerschmidt <>
Sent: Friday, September 28, 2018 2:00 AM
To: OpenSceneGraph Users <>; Rowley, Marlin R (US) <>
Subject: EXTERNAL: Re: Value of a variable in shaders?

Hi,

Usually you can use the output-colors in case of a fragment shader to inspect the values per fragment. Rendering to a texture and inspecting the values in the image is also an option.

Another approach to display incoming/per state values is this nifty shader:

http://mew.cx/drawtext/drawtext.html

Appart from this, in case you're using a modern Nvidia-GPU and
Visual-Studio:

https://developer.nvidia.com/nsight-visual-studio-edition

Cheers
Sebastian



Am 27.09.2018 um 20:14 schrieb Rowley, Marlin R:
Quote:
All,

Is there a way to examine variable values in shader code? I cant
figure out this problem that we are having unless I can see the values
in the shaders.

Any help would be appreciated

----------------------------------------

Marlin Rowley

Software Engineer, Staff

cid:

/Missiles and Fire Control/

972-603-1931 (office)

214-926-0622 (mobile)

<mailto:>




org



------------------
Post generated by Mail2Forum
Back to top
Rowley, Marlin R
Guest





PostPosted: Fri Sep 28, 2018 1:48 pm    Post subject:
EXTERNAL: Re: Value of a variable in shaders?
Reply with quote

Robert,

LOL @ mis-reading my question. 😊

How would you check the values of vertices? I just need to see the transformed values of a vertex.

Thanks,

-M

----------------------------------------
Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)


-----Original Message-----
From: osg-users <> On Behalf Of Robert Osfield
Sent: Friday, September 28, 2018 3:41 AM
To: OpenSceneGraph Users <>
Subject: EXTERNAL: Re: Value of a variable in shaders?

Hi Marlin,

On Fri, 28 Sep 2018 at 07:40, Robert Osfield <> wrote:
Quote:
To pass data into shaders you have use a combination of uniforms (osg::Unfiorm), textures (osg::Textre*) and vertex attributes. With recent 3.4.x onwards you also have the option of passing in constants via #prama(tic) shader composition system that passes #define values into the compilation of shaders.

Seems I mis-read your question Smile

Testing internal values in shader is an easy thing to do, what I end up doing is build up shaders bit by bit making sure each bit works on it's own before I assemble it into a more complex shader. When I want to test values I usually just set the fragment colour value, though often this will have a processed version of the value to make it visible. You can use #ifdef's in shaders to toggle the debug code paths and even toggle these paths on/off via the osg::StateSet::setDefine("ENABLE_DEBUG");

Robert.



------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Fri Sep 28, 2018 1:54 pm    Post subject:
EXTERNAL: Re: Value of a variable in shaders?
Reply with quote

On Fri, 28 Sep 2018 at 14:48, Rowley, Marlin R < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
LOL @ mis-reading my question. 😊


My best excuses is speed reading and trying to do too many things at once Smile

 
Quote:
How would you check the values of vertices?  I just need to see the transformed values of a vertex.


One way would be to use a draw callback attached to the program osg::Geometry that reports the current ModelView and Projection matrices and the list of vertices, at least then you could double check the input values.


Checking the vertices on GPU isn't don't something that is easy at runtime without changing the rendering quite extensively such as using Transfom_Feedback:


    https://www.khronos.org/opengl/wiki/Transform_Feedback


The other possibility would be to see what tools are available on your OS/hardware/driver combination.

 

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Value of a variable in shaders? Rowley, Marlin R General 4 Thu Sep 27, 2018 6:14 pm View latest post
No new posts EXTERNAL: Re: LookAt() function param... Rowley, Marlin R General 0 Mon Aug 13, 2018 2:59 pm View latest post
No new posts EXTERNAL: Re: World space normal. Rowley, Marlin R General 1 Wed Jul 11, 2018 4:30 pm View latest post
No new posts EXTERNAL: Announcement: VulkanSceneGr... Rowley, Marlin R General 0 Mon Jun 04, 2018 3:00 pm View latest post
No new posts EXTERNAL: Re: EXTERNAL: Re: FBO setup... Rowley, Marlin R General 0 Thu May 10, 2018 12:56 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP