Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Tracesets handling proposal

Aperta
#2,146 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Attiva
Ambito
compilers

Direzione di ricerca

Inizia dalla documentazione attuale di OSL trace e dalla sintassi traceset esistente descritta nell’issue. Confronta gli elenchi di inclusione/esclusione proposti, gli argomenti tupla, gli insiemi impliciti e la sintassi delle espressioni prima di scegliere una direzione mirata. Il lavoro è completato quando sono state concordate una specifica e un piano definito di implementazione e validazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Motivation

The OSL, in its current state, doesn't specify technical details or syntax, other than this line in the docs:

An optional named set of objects to ray trace (if preceded by a - character, it means to exclude that set).

So technically it can only pass an inclusion or exclusion list of predefined sets (not an expression) to the renderer.
Simple logical operations unavailable, e.g.: "Character -Hair"

Sometimes we want to trace only against the object itself, or exclude the currently shaded object from tracing without creating hundreds of tracesets for all instances.
We can employ string features of OSL to implement desired behaviour, but it's inefficient.

Workarounds

Exclude itself ( taken from LaSh )

// Assign unique tracesets to all objects in DCC ahead of rendertime. (RfK should do it for you)

string traceset;
getattribute( "identifier:name", traceset );
traceset = concat( "-", traceset );  // String concatination isn't efficient

int  hit = trace( P, dir,
                "traceset", traceset );

Allow user to format string. User is free to set the userDefined parameter to "%s" or "-%s" or "%s ground"

// Assign unique tracesets to all objects in DCC ahead of rendertime.

string self, resultingTraceset;
getattribute( "grouping:membership", self);
resultingTraceset = format(userDefined, self);  // Performance warning about rendertime formatting

int  hit = trace( P, dir,
                "traceset", resultingTraceset );
Image

Inspiration

VEX - SideFX Houdini language allows you to:

use wildcards "Object*"
use complex expressions "Object*,^*left"
refer to implicit sets using special keywords like "scope:self"

Pixar RenderMan texture system allows you to do complex string substitutions to define texture paths.

<primstr:primvarname> - will substitute the value of the named constant string primitive variable, such as the name of an asset; for example,"/assets/<primstr:model>/diffuse.tex" on an apple with "const string model" ["apple"] would be expanded to "/assets/apple/diffuse.tex"

Seems Arnold renderer also has an implicit self traceset assignment, but I didn't find it in the documentation.

Adopting these ideas and syntax in the language might be very helpful in solving current problems. However, I understand the complexity of this solution.

Simpler solution

Even without introducing a complex evaluation system, we can achieve more flexibility and robustness by:

Separating the inclusion list from the exclusion list in the trace signature will allow simple constructions (e.g. include Character, but not its Hair) and prevent preceding "-" concatenation.

int trace (point pos, vector dir,
           "tracesetInclude", string includeList,
           "tracesetExclude,  string excludeList)

Accepting tracesets as tuples (not as a single string) will also help to avoid runtime string concatenations and potentially parsing at render time.

int trace (point pos, vector dir,
           "tracesetInclude", string[] includeList,
           "tracesetExclude,  string[] excludeList)

Having OSL opinion about implicit tracesets (like current object or objects with current material assigned (Thanks, Chriss) ) in the specification will help write efficient and transferable shaders.

Lingua principale
C++
Stelle
2.3k
Fork
415
Merge medio
2g 10h
PR unite (30g)
14

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di AcademySoftwareFoundation/OpenShadingLanguage

Tutte le issue di AcademySoftwareFoundation/OpenShadingLanguage

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.