GithubHelp home page GithubHelp logo

hannahsheahan / hcategorylearn Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 4.0 787.98 MB

A procedural generator of 3D Unity objects with hierarchically organized (but smoothly sampled) perceptual features. For use in category learning experiments on humans and neural networks

ShaderLab 8.62% C# 87.32% HLSL 0.33% JavaScript 0.08% CSS 0.11% HTML 0.06% Objective-C 0.38% GLSL 2.27% SCSS 0.85%
unity sebastian-lague planets psychology-experiments hierarchy perception learning

hcategorylearn's Introduction

๐ŸŒ HCategoryLearn

Unity Editor Version: 2018.3.1

This repo has been developed from Sebastian Lague's brilliant tutorial on procedural object generation in Unity. I've developed Sebastian's planets for use in psychology experiments which test how well people can learn and represent a heirarchical taxonomy of planets.

Experimental psychologists

Planet properties currently manipulated in Planet.cs

  • ๐ŸŒ‹ mountain height
  • ๐ŸŒ mountain spatial frequency
  • โ˜€๏ธ planet proximity to sun
  • ๐Ÿ’จ atmosphere strength
  • ๐ŸŽจ planet colour saturation
  • ๐ŸŒœ mooniness (number & size of moons)
  • ๐Ÿ’ซ orbital ring radius

๐Ÿ”ง Major developments

  • Building a galaxy for our spinning planet to sit in. Includes a night sky, slowly drifting space dust and a sun which varies in proximity to the planet
  • Building additional external planet features e.g. orbital ring which varies in radius and (optionally) thickness, a smokey atmosphere around our planet which varies in intensity, random moons which rotate with our planet
  • Fixed colour gradients along planet mountians and within planet seas to vary as a function of a single random colour theme
  • Restricted variation in planet mountain textures, they now vary along just two dimensions on a single layer
  • Built an image generator which automatically screen captures each generated planet and associated particle systems, saves to.jpg with a lookup .json file containing all planet details
  • Shortlisted ways to retrict planet randomness to different across-planet correlation structures:
    • a flat structure in which there is no feature-correlation across planets;
    • a hierarchical structure such that planets positioned within a branch of a tree have more highly correlated features than those on different branches;
    • single feature variability, all others fixed (useful for psychometric tuning or debugging)

Most interesting settings can be edited in Planet.cs.

Downloading and installing

  1. Download and install the free version of Unity.
  2. Download and install Visual Studio (itโ€™s a nice text editor for C#, but feel free to use any other text editor you like e.g. Atom, Xcodeโ€ฆ).
  3. If you have a Github account, select:
+ gitHub.com/hannahsheahan/HCategoryLearn

and fork it to your account.

  1. Open the Unity project on your computer.

  2. Add our single Scene (PlanetScene) to the build settings: File > Build Settings > Drag and drop scene into the Scenes in Build box > Close the Build Settings.

Setting a data save path

Edit the script ScreenRecorder.cs, and replace the path string for the variable 'folder' with a path to an empty local folder on your machine, which will hold the generated planet images. Also change the filePath in Planet.cs to wherever you want to store the associated .json metadata.

Running the planet generator

  1. Open (double-click) the scene โ€˜PlanetSceneโ€™ in the Project menu.
  2. Run the scene from within Unity (either press the play button at top of Unity, or press cmd+P ). To quit running the scene press cmd+P again.
  3. Run the scene. Now, while the scene is running, go to the Hierarchy menu. Expand the game object named Rotating Planet Things, and click on the object named Planet. Properties for the Planet will appear in the Inspector. You will notice a set of three very useful buttons called Generate Planet, Reset Planet Settings and Generate Full Stimulus Set. The first of these buttons is a bit boring and just generates a single planet according to the current settings. The second button Reset Planet Settings will generate a planet with completely random settings which are not restricted by the across-planet structure we've set in the script Planet.cs, but it will not save an image of this planet. The final button will generate a full set of planets according to the across-planet structure we have imposed, and save images and a planet-feature-lookup .json file to the empty folder you named previously in the script ScreenRecorder.cs.
  4. One final tip. If there is already a generated planet look-up file in the folder we set for our images to be saved in, this will restrict the settings that each new stimulus set will take on. ie. these settings will be loaded and used for generating further planets. So if you are playing around with different feature settings, remember to delete the generated lookup file between runs! Enjoy!

Any questions or problems, please let me know or send me a pull request. Please feel free to use this repo for whatever you like, but please credit both myself and Sebastian Lague.

hcategorylearn's People

Contributors

hannahsheahan avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.