ImageMonkey / imagemonkey-core

ImageMonkey is an attempt to create a free, public open source image dataset.
https://imagemonkey.io
47 stars 10 forks source link

info .. renderer project #294

Open dobkeratops opened 3 years ago

dobkeratops commented 3 years ago

thought id share some recent progress on my rust renderer. i pulled some features across from my c++ version, and got s bit further with lights/materials (clustered forward+ with normal mapped scenery) . I bounce between the languages .. still more comfortable in c+ .. in the past couple of months rust is really starting to click

https://vimeo.com/567738378

this currrent code is not yet in s public repo. I have a prospective use csse so am figuring out exsctly how to seperste it out. it probebly will appear in time. my longterm goal remains neural nets to enhance game content creation.

guessing normal maps from photos is an obvious use case (train on input = render, output = normsl,light,albedo,specular,gloss). it should be possible to generate a dataset starting from random textures then a net could learn lighting.. I wonder if that could be done with multitask learning - ive seen articles claiming to get a benefit from pretraining vision nets in fractsls.

bbernhard commented 3 years ago

WOW, that looks really awesome!

You mentioned that you used both C++ and Rust for this. Do you have an idea what's roughly the current lines of code ratio (Rust vs C++) at the moment? I've heard from a bunch of people that they are using a mixture of Rust and C/C++, so I am really curious to hear what's your LOC ratio. Are you working on that alone or together with other people? Looks really great - can't wait to see more about that!

dobkeratops commented 3 years ago

I have bounced between two seperate sourcebases, one c++ only (10kloc + larger older peices) one rust only (about 15kloc with a dormant editor in there) . i pulled shaders across and translated some c++ code manually but they’ve diverged now. personally i think mixung c++ and rust is unpleasant - the language needs interfaces built around its ideas (especcialy its tagged unions) to really shine. but going through c bindings is doable as a fallback. i would guess the pain of mixing would negate any benefit (but in web scenarios you might have more seperate processes communicating with data, so thats doable)

i think this is holding back rust adoption.. it needs people who can take a risky leap.

2 things really seem to help rust prigrams scale: tagged unions/pattern match - let you describe a bunch of states formally, cleanly, typesafe (where in c++ youd need fallible improvised encapsulation), and “everything must be initialised” .. make any change to a struct and you are forced to update every place its used. once youre done fighting the compiler.. its surprising how often “it just works” as you intended.

also i just find not needing header files helps alot.. it shouldnt really matter but its so easy for those to get out of sync (skipping prototypes by hacking things in the wrong place etc)

bbernhard commented 2 years ago

Many thanks for sharing all this details!

Rust is on my Todo list for quite some time now, but I haven't found time to play with it. I've heard that people who learned Rust also indirectly improved their C++ skills and wrote more robust C++ code afterwards. As I am writing a lot of C++ code in my day job, it would be really interesting to see whether learning Rust also impacts my C++ skills... :thinking: