Skip to main content
GameDev.net gamedev.net
🔒 Locked

PI in HLSL

Started by GoodFun Mar 30, 2009 at 2:32 PM 1 replies 47.3k views
Original Post
GoodFun
GoodFun
Hi there, I'm currently a bit stomped about how to use PI in a pixel shader... I would have assumed that HLSL has PI defined but that doesn't seem to be the case and searching the net unfortunately doens't yield useful results... anyone know a method other than passing PI into the shader through a constant buffer? Thanks Marcel
MJP
MJP
Uhhhh...you mean other than doing this?

static const float PI = 3.14159265f;
GoodFun
GoodFun
yup, other than doing that :) somehow I would have expected HLSL to have PI defined to the maximum precision it can handle... but I guess I'll just go with a const then

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.