Hi Guys, Just a quick question. Has anyone started work on GLSL shaders being supported with cycles?, As a unified system i would be able to do cut scene animations with cycles but also not break my .FBx / Collada exporter and game engine importer. The last thing i want to be doing is building 2 sets of materials for models (cycles/GLSL) when if cycles supported GLSL in the first place workflow can be massively streamlined. Cheers
In the 3d viewport or the render engine?
Nope. GLSL is compiled at the GPU driver level, includes vertex shaders which Cycles doesn’t support at all and has a feature set designed for rasterization while Cycles is a pathtracer. I’d say the probability of Cycles ever supporting GLSL is nil. That said, you can try porting some of your shaders to OSL. The likelihood of getting them to look the exact same as in your realtime engine is low though. Also, if you try using baked normal maps designed for, say, Unreal in Cycles, you will likely find that your tangent space is wrong and your models look horrible. Cycles expects MikkTSpace tangents which is what Blender bakes out and which are very slowly gaining popularity, but it’ll probably be a while before it’s a standard.
@MadMinstrel, Yep would love to be able to use OSL in my game engine. But that’s a long way off in terms of hardware support so a no go for that. The reason ive asked is because ive seen other path tracers (GPU based) that do use HLSL or GLSL, GLSL support for cycles would be another feather in Blenders cap if dev was agreed. More difficult but an even better result would be a node based openGL GLSL shader editor / Cycles shader editor (again bringing more devs,indies to blender). Again the art pipeline benefits would be massive, If i could do path traced cut scene animations through Blender with cycles with my Game setup shaders your talking months taken of production times for games but allows continuity of look. Also a large part of the design idea for my opengl realtime engine is for players to be able to record there play (not video but in engine action to be recombined for a themed players competition winner movie, idea being a offline film from certain top players interactions to be turned into a movie release, not for sale but for the community of people who bought the game and play the game. Maybe with the prize being the final short film to be shown at the cinema of there choice (imagine being able to go watch a Hollywood quality film, But where you as the player was controlling certain characters Vehicles etc. Turn to your friend and say ’ that was me’). I’ve been thinking about this as a concept for many years, now Steven Spielberg is doing a Halo TV series for xbox one it shows the market has started to kick off.
Does the new pynode system not allow for the development of ‘a node based openGL GLSL shader’ system? As nice as path tracers are for big budget animation studios, I can see a future where ‘real time’ rendering tools offer similar functionality with greatly reduced development time and money.
Can you point me to one?
I’d like to see one too. Considering that GLSL is based around raster techniques and uses mesh, screen, and other info that path tracers can’t even use by their very nature, I’d be interested to see how this would be of any use.
My experience with using both Cycles and BI nodes together on objects is that GLSL shading in the viewport in Blender Render mode won’t display properly. Blender seems to favor the Cycles ‘material’ preview even in Blender Render mode. To get the BI nodes to display correctly in GLSL preview, I’ve had to delete the Cycles nodes. The ‘material’ display mode for Cycles probably uses basic GLSL, otherwise you wouldn’t see anything in the viewport when Cycles is selected. However, as pointed out by m9105826, the very nature of Cycles prevents it from being converted to GLSL or any other ‘real time’ rendering solution in a way that would accurately represent your scene.
If you want to make assets for games you probably need to set up separate scenes or blend files with separation of Cycles and BI/GLSL materials for each object you plan to use. That is, assuming, of course, that you’ll be rendering separate cut scenes in Cycles for playback between the action portions of your games. If not, then you are probably wasting your time even worrying about using Cycles at all.
How many you need? https://code.google.com/p/pathgl/
http://www.madebyevan.com/glsl-path-tracing/
…
I like the last one, WebGL runs sweet in Chrome.
You can generate GLSL code from a Cycles node graph, that’s what Cycles already does (half-heartedly). Supporting GLSL (from a language POV) in Cycles doesn’t make a lot of sense. You’d need to write a whole compiler toolchain (or use OpenGL) and then it’s unlikely you could re-use the same shader in an OpenGL-based engine, unless you wrote it to evaluate shaders similarly to Cycles. At that point, it would be once again easier to generate GLSL from Cycles graphs.
Also, it’s probably feasible to generate GLSL from OSL with a few restrictions.
@Zalamander, Cheers for the info lad. If your feeling extra helpful how about sending me some demonstrations of Cycles graphs to GLSL (or near enough for me to patch). @m9105826, MadMinstrel yeah i didnt answer your attitude filled responses because Arexma sumed up my point quite nicely. I do remember finding something online a while back about someone creating an OSL converter for HLSL & GLSL, Ill see if i can track the guy down. Cheers
The unity video kind of lies. The lighting was baked in mental ray (may have been a different render engine). Its not real time in the sense that all lights are computed at render time
If your feeling extra helpful how about sending me some demonstrations of Cycles graphs to GLSL
The code that does this is in gpu_codegen.c
A path-tracer written in GLSL and a path tracer that uses GLSL materials are two very different things…
I thought as much. These are not pathtracers that support glsl shaders. These are pathtracers that use glsl shaders to perform the pathtracing. That’s an important distinction. I think Vray supports some kind of GLSL material, but I have no idea what restrictions might apply - I’d say it likely doesn’t work in its pathtracing mode though.
…What?
GLSL is just another C-like language, so it’s not entirely far-fetched to use it as your language of choice for programmable shaders. Not all of the builtin GLSL functions and types make sense in a raytracing context, but most do. There isn’t really that much rasterization specific stuff there.
Fun thought: if someone implemented GLSL in cycles you could write a pathtracer that would work within a shader within a pathtracer.
@Zalamanda, Your right. After looking through a few code layers, Also see a lot of cycles node systems that are almost GLSL styled. Pain in the ass but worth further investigation. @ MadMinstrel was pulling your leg, dont take it as a slur. Ive never fully looked through BGE code, have to say it cracks me up hahahaha.