Why use underescores for naming things in 3d industry?

Worldevour
Worldevour polycounter lvl 7
edited Feb 2019 in Technical Talk
Can someone explain why underscores are necessary in naming like this: http://prntscr.com/mokfdn
I don't quite get it.

Welcome!

It looks like you're new here. Sign in or register to get started.

Replies

  • sacboi
    sacboi veteran polycounter
    ....because it looks pretty as a convention.
  • musashidan
    musashidan high dynamic range
    It's just a standard that works. It's so drilled into my head that I use it for every single file on my computer. :)

    Naming conventions are extremely important in an involved project or pipeline that might have 1000s of files and dozens or even 100s of team members. It's easy to understand and helps visually break an asset file name down. For example, a UE4 standard is to put M_ before all materials, or SM_ before all static meshes. This makes it easy to identify asset groups in a large project or scene. SM_small_tree works visually for several reasons, whereas smsmalltree hurts the brain.

    Similarly with texture maps TX_small_tree_normal is so easy to read. txsmalltreenormal.......not so much.

    Of course, none of these are rules, just good practice. Many artists just use hfdhfdjbt6 names in personal projects, but would never get away with it in a pipeline(and it is TERRIBLE practice if handing off assets to a client)


  • Worldevour
    Worldevour polycounter lvl 7
    why not put spaces instead of underscores?
  • Noors
    Noors greentooth
    Because spaces are source of confusion and they're a pain to deal with in programming/scripting like any special character. No spaces in an URL address for instance...Some software might not recognize them properly, so on...
    So dashes, points or underscores... is a general convention for file naming (not only in 3d).
  • SonicBlue
    SonicBlue polycounter lvl 10
    why not put spaces instead of underscores?
    Because in Maya (and most other software) the "space" is an illegal character, you can't even name anything with a number as the first character:

    https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2019/ENU/Maya-Customizing/files/GUID-2D9A00AB-05FD-486B-A510-22C7F02FC5DE-htm.html


    Same with Houdini


  • RN
    RN sublime tool
    In the past it might've been for technical reasons, but now it's probably just a convention.  

    File systems support unicode filenames, they can certainly forgive the use of spaces. For command-line tools, you can enclose in quotes any paths that have spaces.
  • sprunghunt
    sprunghunt polycounter
    Any name with a space in it doesn't actually have a space when it's stored in memory. Instead in windows something like this: 

    desk chair.jpg

    actually is:

    desk%20c~.jpg

    This is because really most operating systems are MS-Dos based (windows, xbox) or unix based (linux, playstation, maya). And neither system actually stores the names with spaces and instead it does weird stuff behind the scenes. 
  • Udjani
    Udjani interpolator
    We have to differentiate ourselves from normies.
  • Worldevour
    Worldevour polycounter lvl 7
    edited Feb 2019
    Older people are so sticking to such weird rules...
  • musashidan
    musashidan high dynamic range
    Older people are so sticking to such weird rules...
    1 - they're not rules, as you were told above
    2 - they're not weird, the reasons were explained above numerous times
    3 - younger people have shit grammar
  • monster
    monster polycounter
    edited Feb 2019
    It's just down to project preference. Here's a screenshot of my last shipped project's Standards Guide.



    Also,...

    younger people have shit grammar 
  • Alex_J
    Alex_J grand marshal polycounter
    y stuff gotta be lik dat all serious n stuff
  • musashidan
    musashidan high dynamic range
    y stuff gotta be lik dat all serious n stuff
    Because the future of the English language is in serious jeopardy........
  • Alex_J
    Alex_J grand marshal polycounter
  • zachagreg
    zachagreg ngon master
    monster said:
    It's just down to project preference. Here's a screenshot of my last shipped project's Standards Guide.



    Also,...

    younger people have shit grammar 
    Snake_case_is_the_best_case
  • zachagreg said:
    Snake_case_is_the_best_case
    And it isn't arbitrary. Snake case allows you to differentiate between var, _var, var_, and _var_ when searching for things in your asset manager,  which makes maintaining a prefix/suffix system a lot easier. It's uglier, and it can be harder to read at times, but it's more forgiving when you're trying to find things before your coffee kicks in.

    CamelCase is still my go-to outside of asset management situations, though.
  • cupsster
    cupsster polycounter lvl 11
    Using spaces in file names is in general VERY BAD IDEA if you work in multimedia industry. Underscore enables clean visual separation of negative space in text and if you like you can sometime even use file name as ad-hoc mini config to store values and parse them very quickly. The sooner you stick with it the better your life will  be. Your potential future coworkers will for sure appreciate this! 
  • Chev
    Chev polycounter lvl 11
    Yeah, it's not just an old thing, even now spaces are kind of a special case character that'll get you in trouble in most scripting languages and operating systems due to their tendency to break folder links, not to mention there's actually a bunch of different characters that look like spaces but aren't, further adding to the confusion.
  • suspectlogic
    suspectlogic polycounter lvl 13
    Some engines are super strict. I can't remember the exact reasons, but our last game engine would break during the building stage if we didn't export art using all lower case naming. To make things easier to read, we just separated words using underscores. (spaces were not allowed, because they'd also break the build)

  • kanga
    kanga quad damage
    Yeah the above and I think in the old days PC disk recovery depended on no caps and twas allowed to separate using the underscore. Anyhow there are enough situation where it works, so use it for everything.
  • sprunghunt
    sprunghunt polycounter
    its odd to me only 1 person has mentioned programming languages dont like spaces.  
    they don't like spaces for the same reason file systems don't like spaces - it all goes into memory and spaces are...

    ...wasted space.

    In general I've found Python programmers like underscores and C-style languages (csharp, C++, mel) tend to use camelCase. 
  • TTools
    TTools polycounter lvl 4
    edited Feb 2019
    +1 to @radiancef0rge
    Spaces in filenames or paths are an absolute bane for tech artists and engineers.  We often times are reading directory paths and files from .csv, .txt, .ini, and a million other places.  We will use end of line, carriage returns, and whitespaces to determine separation of file names, paths, objects and other things (not only in reading from file, but in dealing with data from various locations).  This is one of the reason's dealing with "My Documents" ,"Program Files", and "Program Files (x86), can catch you off guard and be a real pain in the ass.  Your code will be running along swimmingly and then you get a break because your code split up a path into "c:\users\My" and "Documents\Blah" instead of the whole path together.  It's easy enough to resolve, but it's just one more thing to have to compensate for and never fun to encounter.

    It was also said above that many applications don't allow spaces, and automatically convert to "_" to ensure the underlying code is never getting surprised by a rogue space.

    I have also seen version control applications like Perforce automatically reformat filenames to lower case from camelCase when migrating servers...which then caused all python modules to fail on their imports because python is case sensitive.

    The morale of the story is...IMO: your *safest* bet is lowercase separated by underscores, but as @Mark Dygert notes below, the readability of camelCase should not be understated.
     


  • sacboi
    sacboi veteran polycounter
    edited Feb 2019

    +1 @TTools

    A succinct explanation which I hope clarifies for the OP **WHY** the necessity for underscores, especially when as creative's we do by and large 'inhabit' digital space via doodling our creations, so at the end of the day forestall 'rogue space' by following convention:

    period_end_string

    Cheers.

  • TTools
    TTools polycounter lvl 4
    they don't like spaces for the same reason file systems don't like spaces - it all goes into memory and spaces are...

    ...wasted space.

    In general I've found Python programmers like underscores and C-style languages (csharp, C++, mel) tend to use camelCase. 
    An interesting note you bring up regarding Python and C based languages.  I've seen the same thing, particularly with Autodesk code.  99% of all Mel scripts and even their python code utilizes camelCase for variables and functions.  What's interesting is that this is counter to PEP8 guidelines (no camelCase for either, only classes...IIRC).
    https://www.python.org/dev/peps/pep-0008/  

    For years and years I utilized camelCase in all of my code, as I followed convention with all of the other code (typically Mel) that I was learning from.  However, I've recently changed that behavior to much more strict PEP8 compliance (no camelCase for variable or function names (PEP N802 I think it is).  The reason I made this switch was because a very senior engineer advised me that in order to utilize a linter (an application that performs automated code inspections), it was best to adhere to strict PEP8 compliance.  This ensures consistency across all co-developed code and automated code inspection. I suppose you could create exceptions for your linter...but that might be a slippery slope.

    This is certainly something that I'm sure is very debatable among tech artists and engineers, but in a very large production environment I have discovered that it is useful in maintaining quality standards.

    If you use an IDE like PyCharm it has automatic PEP8 code inspections built in which makes compliance easy. :)


Welcome!

It looks like you're new here. Sign in or register to get started.