Archived post by flakypastries

yeah I am not sure this is possible either, since the texture is part of a shader evaluation but LPEs deal strictly with rays.

Depends on the Houdini version. In H21 we now have the RaySwitch VOP (finally!), so we can build a shader-based setup like this. If Efficient Emissive Sampling is on, Karma treats this like a light and contributes to direct rays.
Yes it’s hacky but it actually works fairly well. You could expose a bunch of subnet inputs to facilitate later editing on the stage. And also in 21 we can then supply a stencil map via RGS on the card to cut it out. What I have not confirmed is how well Karma does importance sampling with this method (MIS on textured lighting effects has been hit or miss with Karma in my experience)
But this at least gives easy separate controls over camera rays vs scene rays.

@Jonesy you were asking the other day about possible applications of the RaySwitch VOP

on the topc if LPEs, here is a list I have been maintaining of Karma LPEs as they crop up. These syntaxes have been tested in production but if anyone spots a problem please let me know. And if you know of other useful ones, I would love to know what they are. There are all kinds of things you can do.
gist.github.com/tcrowson/5d033817c63cf6cf27f3703e2df9462b

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20265305/08/26/image.png

Archived post by lewis.taylor.

“`vector @cdir; matrix camMatrix = optransform(chs(“camera”)); @cdir = cracktransform(0,0,0, {0,0,0}, camMatrix); float distance_to_cam = distance(@P, @cdir); float cam_aperture = chf(“camera_aperture”); float cam_xres = chf(“camera_xres”); float focal_length = chf(“focal_length”);
f@voxel_size = chf(“coverage”) * (cam_aperture / cam_xres) * (distance_to_cam / focal_length);“`

this is the base code in the voxel res tool I made

which is in the SYD HUG hip file

it’s in the same wheelhouse

was actually originally used to do the particle scale control hehe

Archived post by ogvfx

This is something I learned at dreamworks awhile back to do pscale to pixel calulations from camera.
it creates a uv on the particles coming in on the second input then used the cameras info to calculate the pscale at a pixel level.
“`//get camera details float aperture = chf(“aperture”); // ch(chsop(“../camera”) + “/aperture”) float focal = chf(“focal”);’ // ch(chsop(“../camera”) + “/focal”) float resolution = chf(“resolution”); // ch(chsop(“../camera”) + “/resx”)+1 / 1 float pixel_width = chf(“pixel_width”); // ch(“../paticle_pixel_size”) // this gets used to increase or decrease based on a pixel default of 1 is set to 1 pixel
//get uv camera vector camUV = point(1,”uv”,@ptnum);
float uvZ = camUV.z;
//calculate camera scale
float cameraScale = (aperture/focal/resolution) ;

//set new pscale if(ch(“../pscale_operation”)==0) f@pscale = uvZ * cameraScale * (pixel_width*.5);
//multiply pscale
if(ch(“../pscale_operation”)==1) f@pscale *= uvZ * cameraScale * (pixel_width*.5); “`

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20265902/20/26/nxplayer.bin_96rUEVP4Kb.png
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20265902/20/26/nxplayer.bin_naczKWgDws.png

Archived post by lwwwwwws

ok that pic flight took of the sunset shadow had been bugging me (discord.com/channels/270023348623376395/351983374510063636/1427701531674939523) so i did the obvious thing: downloaded an etopo DEM geotiff and used it to displace a scale model of the earth with a layer of uniform volume for the atmosphere, then looked up exactly which direction the sun set in on that day and put a sphere light over there 149 million km away 🌄 waddya know there are two mountains in just the right place and karma can kind of render a sunset even though it’s not spectral and doesn’t really have rayleigh scattering lobes

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20250110/16/25/Ls_KarmaSunset_v01.zip
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20250110/16/25/Screenshot_2025-10-16_at_21.20.12.png
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20250110/16/25/Screenshot_2025-10-16_at_21.10.22.png
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20250110/16/25/Screenshot_2025-10-16_at_21.12.10.png