int samples = 30;
string lightOP = “../../arealight1”;
matrix lightmat = optransform(lightOP);
for(int s=0; s < samples; s++) {
vector lightCd = chv(lightOP + “/light_color”);
vector sampleP = random(@ptnum, s*123);
sampleP = fit01(sampleP, {-0.5,-0.5,0}, {0.5,0.5,0});
vector lightP = sampleP * lightmat;
vector lightray = lightP - v@P;
vector offset = v@N*0.001;
vector lP, luv;
float lightvis = (intersect(0, v@P+offset, lightray, lP, luv) == -1);
f@lightvis = lightvis;
float geoterm = clamp(dot(v@N, normalize(lightray)), 0, 1);
v@Cd += lightCd * lightvis * geoterm;
}
v@Cd = v@Cd / float(samples);
//END
It's a simple for loop, but I'm still new to opencl, can someone help? thanks
needs help converting vex code into opencl
1559 3 1- ouroboros1221
- Member
- 79 posts
- Joined: Feb. 2016
- Offline
- jsmack
- Member
- 7737 posts
- Joined: Sept. 2011
- Offline
- ouroboros1221
- Member
- 79 posts
- Joined: Feb. 2016
- Offline
- Konstantin Magnus
- Member
- 670 posts
- Joined: Sept. 2013
- Offline
ouroboros1221
I intuitively thought whatever is available to VEX is also available to openCL
No, I guess it´s quite the opposite.
Please someone prove me wrong, but as far as I know:
- No VEX function at all is available in OpenCL.
- OpenCL does not come with comparable functions, either.
- You have to create all necessary attributes beforehand.
- All you can do is manipulate existing attributes.
- Everything has to be solved purely mathematically.
- You cannot delete or create geometry right away.
Edited by Konstantin Magnus - Feb. 14, 2023 19:41:06
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
-
- Quick Links