Computer Graphics: Raytracing and Programming 3D Renders - programming-languages

I've noticed that a number of top universities are offering courses where students are taught subjects relating to Computer Graphics for their CS majors. Sadly this is something not offered by my university and something I would really like to get into sometime in the next couple of years.
A couple of the projects I've found from some universities are great, although I'm mostly interested in two things:
Raytracing:
I want to write a Raytracer within the next two years. What do I need to know? I'm not a fantastic programmer yet (Java, C and Prolog are my main languages as of today) but I'm slowly learning every day. Also, my Math background isn't all that great, so any pointers on books to read or advice on writing such a program would be fantastic. I tend to pick these things up pretty quickly so feel free to chuck references at me.
Programming 3D Rendered Models
I've looked at a couple of projects where students have developed models and used them in games. I've made a couple of 2D games with raster images but have never worked with 3D models. What would I need to learn in regards to programming these models? If it helps I used to be okay with 3D Studio Max and Cinema4D (although every single course seems to use Maya), but haven't touched it in about four years.
Sorry for posting such vague and, let's be honest, stupid questions. It's just something I've wanted to do for a while and something that'd be good as a large project for me to develop in my own time.
Related Questions
Literature and Tutorials for Writing a Ray Tracer

I can recommend pbrt, it's a book and a physically-based renderer used to teach computer science graduates. The description of the maths used is nice and clear, and since it is written in the 'literate programming' you can see the appropriate code (in C++) too.

The book "Computer Graphics: Principles and Practice" (known in the Computer Graphics circles as the "Foley-VanDam") is the basic for most computer graphics courses, and it covers the topic of implementing a ray-tracer in much detail. It is quite dated, but it's still the best, afaik, and the basic principles remain the same.
I also second the recommendation for Eric Lengyel's Mathematics for 3D Game Programming and Computer Graphics. It's not as thorough, but it's a wonderful review of the math basics you need for 3D programming, it has very useful summaries at the end of each chapter, and it's written in an approachable, not too scary way.
In addition, you'll probably want some OpenGL or DirectX basics. It's easier to start working with a 3D API, then learn the underlying maths than the opposite (in my opinion), but both options are possible. Just look for OpenGL on SO and you should find a couple of good references as well.

The 2000 ICFP Programming Contest asked participants to build a ray tracer in three days. They have a good specification for a simple ray tracer, and you can get code for the winning entries and some other entries as well. There were entries in a large number of different programming languages. This might be a nice way for you to get started.

The briefest useful answer I can give is that most of the important algorithms can be found in Real-Time Rendering by Tomas Akenine-Möller, Eric Haines, and Naty Hoffman, and the bibliography at the end has references to the necessary maths. Their website has a recommended reading list as well.
The most useful math book I've read on the subject is Eric Lengyel's Mathematics for 3D Game Programming and Computer Graphics. The maths you need most are geometry (obviously) and linear algebra (for dealing with all the matrices).

I took such a class last year, and I believe that the class was wonderful for forcing students to learn the math behind the computer graphics - not just the commands for making a computer do what you want.
My professor has a site located here and it has his lecture notes and problem sets that you can take a look through.
Our final project was indeed a raytracer, but once you know the mathematics behind it, coding (an inefficient one) is trivial.

For a mathematical introduction into these topics, see
http://graphics.idav.ucdavis.edu/education/GraphicsNotes/homepage.html

Check http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-1-writing-a-simple-raytracer/
This is a very good place to learn about ray tracing and rendering in general.

Related

What does func _physics_process(delta), move_and_slide(), Vector2() and do in gdscript?

I'm just started learning to program because I want to learn how to make a game. I choose the Godot engine to start making games but I can't understand what anything does. I have only understood the concept of variables and constants. I'm watching a couple of tutorials and copying exactly what the people in the video are doing but I don't just wanna copy and not understand anything, so could you please tell me what the above things even do?
The physics process is called during the physics processing step of the main loop. Physics processing means that the frame rate is synced to the physics, i.e. the delta variable should be constant which isn't the case if you just call _process(delta):
Vector2() is just a 2d vector, the first parameter for the x axis, the second for y.
You can use it also as an boolean, Vector(0,0) always returns false, while every other point returns true.
move_and_slide() was designed as a special case, because a common use case was to calculate a slide vector along the collision. However, because it slides, it's possible for there to be more than one collision in a frame (think when you hit a corner between the floor and the wall. For this reason, it can't return a collision, so you need to use the get_slide_collision().
So it handles for example how your character react if he collides with an object.
I was just looking into more information on what the _physics_process(delta) function does and came across this thread (kajus_the_dwarf's answer was very helpful)
I just had to chime in and note that about roughly this same time you had asked this question last year, I was in a very similar place. I have plenty of 3d experience but was a complete noob at programming, and because of this many of the godot tutorials went way over my head. I was able to copy the tutorials step-by-step but struggled to wrap my mind around what was actually happening.
What has helped me immensely, and what I'd highly recommend for you, is to follow some beginner python programming courses. I've heard Godot's language gdscript described as pythonic C#, it is a unique and highly intuitive programming language that draws many features from C, C++, and C# but follows a simple python syntax. Studying one of the C languages would certainly help in further boosting your understanding, but I would personally suggest studying python because even though godot doesn't utilize all of pythons features, when you're programming in gdscript it feels like you're essentially programming in python.
What I did was downloaded a free app on my phone called "sololearn" which makes it really easy to learn any of the major programming languages of your choosing in a structured and enjoyable experience. I followed the python beginner and intermediate courses on that app and now godot makes so much more sense to me.
I would also recommend the youtuber "Corey Schafer" who has some of the best beginner tutorials out there thanks to his solid understanding and engaging teaching style.
so yup, that's my advice from a fellow student on this godot adventure;
study python!

What is a good programming language to start my Grade 1 son learning? [duplicate]

This question already has answers here:
Closed 13 years ago.
Possible Duplicates:
How to get kids into programming
Suggestions on starting a child programming.
Is there a really simple programming language that I can use to teach my 6 year old son concepts of programming, syntax and logic?
I'm probably the only one here with this opinion, but I think 6 is too young to start a child on programming. Those years are critical for development of a whole host of skills including social skills that are not computer-related (that, indeed, may be antithetical to computer use) and intellectual ones that actually will contributed to computing skills later on (I'm talking about math and problem solving skills).
I've started introducing my kids to programming at the ages of 8 and 10, but I don't expect them to take a serious interest in it until their middle school years (starting at age 11/12). In general my kids spend much, much less time in front of a computer than their classmates. They both lead their classes academically and are well socially adjusted.
Logo. Designed specifically by Seymour Papert to teach children how to program how to deal with recursion etc. etc. all without using those words to put people of. Particularly when linked to turtle graphics to give a readily available and recognisable output and feedback.
Because it was designed to cover all the fundamentals in programming it does not necessarily major in anything, but the ides is to give the children all the core fundamentals.
Try Scratch.
Take a look at Small Basic from Microsoft.
By providing a small and easy to learn
programming language in a friendly and
inviting development environment,
Small Basic makes programming a
breeze. Ideal for kids and adults
alike, Small Basic helps beginners
take the first step into the wonderful
world of programming.
I think the quote sums it up, really! :)
Yes, there is Plain English Programming Language
Check out www.pythonturtle.org
Guido van Robot is a logo like application that uses Python.
(source: sourceforge.net)
I suggest python via Snake Wrangling for Kids:
“Snake Wrangling for Kids” is a
printable electronic book, for
children 8 years and older, who would
like to learn computer programming. It
covers the very basics of programming,
and uses the Python 3 programming
language to teach the concepts.
Personally I think Tcl is perfect as a beginning language, especially for young people. It has an interactive console for instant gratification, and tk is by far one of the easiest GUI toolkits on the planet. One or two lines of code to see a window on a screen. Just a couple lines of code to create a canvas and draw rudimentary shapes, etc.
I know many people don't like Tcl, but I think that's more out of ignorance than anything else. And I mean that in a good way -- if you don't understand Tcl but know more traditional languages, it's hard to see the beauty in such a simple yet powerful language. The whole definition of the language fits in a single man page, so it's easy to grasp the fundamentals.
Finally, as a teaching tool it lets you recreate just about any language construct you wish. You can not only show them for and while loops, you can create repeat/until loops, or anything other types of looping to emulate other languages.
I started learning programming in the hey-day of Pascal, a language which many would say is designed for learning. Here's a quote from Wikipedia:
Criticism
While very popular (although more so in the 1980s and early 1990s than now), implementations of Pascal which closely followed Wirth's initial definition of the language were widely criticized for being unsuitable for use outside of teaching.
Take that for what you will =)
turbo pascal? :) gwbasic? and nextly python :)
Well, Python has very English like syntax that makes it relatively easy to pick up. Python IDLE works in a read-eval-loop mode, so you don't have to go through compiling or anything. You can type code in line-by-line and get instant feedback. It also has an interactive help mode. If he needed to know what some function does, and you weren't there to help him, he could just type help(someFunction)
There was a comment about how it can become confusing when you mix tabs and spaces in Python. In response to that comment, most editors have an option to automatically replace tabs with X spaces. In IDLE, it's as simple as Format->Toggle Tabs to make it so whenever you press the tab key, it inserts 8 spaces instead of a tab.
Labview is completely visual. It's mainly used to program robots. It's extremely logic oriented. However, there's quite a big price tag on it.
SmallTalk. It was created for educational use.
I have to agree that six years old sounds a bit young though... if they don't want to learn, don't try to force them.
I think the framework is important too. Your kid should be able to create a game without too much ado. Python + pygame springs to mind.
http://en.wikipedia.org/wiki/Logo_(programming_language)

What are some good resources for writing a chess engine? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm interested in writing a chess engine (mostly as a learning exercise) and would be interested in any resources that people know of that could be of interest or use, anything really: Papers, Books, Theory, Tutorials, anything that could be useful.
From my archives:
This is a useful chess programming wiki.
This is a simple introduction to chess programming.
This is a (free) book on chess algorithms.
This contains several easy step-by-step YouTube tutorial series' ranging from beginner to advanced level.
This is a more advanced introduction.
This is Adam Berent's interesting computer chess blog.
This is a good analysis of MTD(f), an interesting search algorithm.
This is a good guide to validation of move generation.
This is lots of good information on the Rebel chess engine.
This is lots of good information on the Dark Thought chess engine.
Good information and source code for the Monsoon chess engine.
These are more notes on chess programming.
A reasonable introduction to rotated bitboards.
A reasonable introduction to magic bitboards.
A reasonable introduction to late move reductions.
A look at null-move pruning.
A collection of position sets for testing purposes.
Here is an old report from 2 students who wrote a chess program.
A bunch of miscellaneous chess programming links.
Finally, here is Wikipedia's take on computer chess.
When creating my chess engine I spent months trying to collect good resources that describe some of the harder aspects of creating a chess game. Here is a list of the ones I found most useful:
Chess Programming by François Dominic Laramée
This is the article that got me into computer chess, It is a great overview of how computers play chess. It is extremely easy to read and it will introduce you to all the terms and keywords.
http://www.gamedev.net/page/resources/_/technical/artificial-intelligence/chess-programming-part-i-getting-started-r1014
Computer chess wiki, this has really expanded over the last few months. It is an excellent resource for reference material.
https://www.chessprogramming.org/Main_Page
Louis Kessler's Computer Chess Links
Once you go through the above resources the remainder can be found at the following links page.
http://www.lkessler.com/cclinks.shtml
Last but not least I write a Computer Chess Blog that takes you through all the steps of writing a chess engine in C# from scratch, it includes a computer chess links section and a chess game starter kit.
http://www.chessbin.com
Adam Berent
I have joined the same league of Paul Wicks(above), I too want to write a chess engine for my own learning sake's, only constraint is my day job(which is to work on boring web services and stuff..) but its worth the pain.
I decided to build it using layer-by-layer approach.
I'm almost through with the multi-player part i.e. (HUMAN vs HUMAN).
Once I'm done with this, I would love to incorporate the AI layer to support (COMPUTER vs HUMAN) playing scheme.This is the part that I'm most worried about, I have found very nice help tips here in this thread, a big thanks to all of you.
Currently the language that I'm well versed with is Java, in case there's a performance hit
then I might port it to C++.
This is basically in the field of Artificial Intelligence (AI).
The most common way to make a computer "think" in chess game is using the mini-max method where computer "think" by analyzing the results from making different moves ahead of time from the current state.
The "goodness" of results from different moves can be determine from many criteria such as score, number of enemies left, winning state, for example. For instance, if you move the player to the right and you win the game, that's a very good state. But if you move it to the left you get nothing. It is reasonable to move to the right. This function that define "goodness" is usually called Heuristic Function.
This process is done recursively for many turns. The greater the number of turns, the more time you will need. And the greater the number of turns, the more intelligent your software is. Thinking ahead in only one turn may only result in greedy selection. Intelligent chess software has great heuristic function and think ahead in many turns.
ps. There are some details of mini-max algorithm I didn't explain here but this should cover the basic idea.

Graduate Level Degree for Simulation/Statistics/Prediction?

I am wondering if anyone has any insight into this. I am thinking of going to grad school to get some computer science related degree. I have always been intrigued by people who are working on problems using statistical packages or simulation to solve problems. What would I study to get a good breadth of knowledge of these things? Do they fall into machine learning?
Thanks
My girlfriend is getting a degree in mathematics with an emphasis in Statistics and Operations Research.
She does a lot of work with SAS and other statistical software to maximize certain functions and predict the likelihood of future events. It may be more mathematics then you like, but you might try looking for masters of CS programs with an emphasis in Operations Research or Statistics.
There's a wide range of possible opportunities here. Let me add the following choices:
Physics with a focus on complex networks. This has applications in biology, epidemiology, sociology, finance, and computer science.
A good machine learning program, with statistics, data mining, text analysis, and computational learning theory.
Industrial engineering/operations research, with simulation, reliability, and process control.
I'd be happy to talk further about this, please put questions in comments.
I would assume that your school would offer some actual Statistics courses, probably in the Math department, which you could take to learn all about this.
Study a lot of mathematics, especially probability and statistics. I have a graduate simulation course right now, and I wish I knew more probs/stats stuff.
In Biostatics (at the U of Minnesota), we did a lot of simulation, in areas like Bayesian statistics, genetics, and others. Any strongly analytical program is a good candidate for teaching the skills you want, including: econ, econometrics, agronomics, statistical genetics... etc., etc., :)
While you're waiting, pick up R, Matlab (Octave is the free implementation), or your Turing-Complete language of choice, dig into Wikipedia, and get to work :)
I'd like to second Gregg Lind's recommendation of thinking about statistics in the biological sciences. It's well-funded, there's a lot of interesting work going on (both theoretical and applied!), and you can sound really cool at parties because somehow, someway you can always make some sort of connection from your work back to curing cancer. :)
Seriously though, a lot of great statistical work was done in the early 20th century by people like Haldane, Fiscer and Wright. More recent interesting work has been done on analysis or large data sets, multiple hypothesis testing, and applied machine learning. It's super exciting. Come join us!

What are good starting points for someone interested in natural language processing? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Question
So I've recently came up with some new possible projects that would have to deal with deriving 'meaning' from text submitted and generated by users.
Natural language processing is the field that deals with these kinds of issues, and after some initial research I found the OpenNLP Hub and university collaborations like the attempto project. And stackoverflow has this.
If anyone could link me to some good resources, from reseach papers and introductionary texts to apis, I'd be happier than a 6 year-old kid opening his christmas presents!
Update
Through one of your recommendations I've found opencyc ('the world's largest and most complete general knowledge base and commonsense reasoning engine'). Even more amazing still, there's a project that is a distilled version of opencyc called UMBEL. It features semantic data in rdf/owl/skos n3 syntax.
I've also stumbled upon antlr, a parser generator for 'constructing recognizers, interpreters, compilers, and translators from grammatical descriptions'.
And there's a question on here by me, that lists tons of free and open data.
Thanks stackoverflow community!
Tough call, NLP is a much wider field than most people think it is. Basically, language can be split up into several categories, which will require you to learn totally different things.
Before I start, let me tell you that I doubt you'll have any notable success (as a professional, at least) without having a degree in some (closely related) field. There is a lot of theory involved, most of it is dry stuff and hard to learn. You'll need a lot of endurance and most of all: time.
If you're interested in the meaning of text, well, that's the Next Big Thing. Semantic search engines are predicted as initiating Web 3.0, but we're far from 'there' yet. Extracting logic from a text is dependant on several steps:
Tokenization, Chunking
Disambiguation on a lexical level (Time flies like an arrow, but fruit flies like a banana.)
Syntactic Parsing
Morphological analysis (tense, aspect, case, number, whatnot)
A small list, off the top of my head. There's more :-), and many more details to each point. For example, when I say "parsing", what is this? There are many different parsing algorithms, and there are just as many parsing formalisms. Among the most powerful are Tree-adjoining grammar and Head-driven phrase structure grammar. But both of them are hardly used in the field (for now). Usually, you'll be dealing with some half-baked generative approach, and will have to conduct morphological analysis yourself.
Going from there to semantics is a big step. A Syntax/Semantics interface is dependant both, on the syntactic and semantic framework employed, and there is no single working solution yet. On the semantic side, there's classic generative semantics, then there is Discourse Representation Theory, dynamic semantics, and many more. Even the logical formalism everything is based on is still not well-defined. Some say one should use first-order logic, but that hardly seems sufficient; then there is intensional logic, as used by Montague, but that seems overly complex, and computationally unfeasible. There also is dynamic logic (Groenendijk and Stokhof have pioneered this stuff. Great stuff!) and very recently, this summer actually, Jeroen Groenendijk presented a new formalism, Inquisitive Semantics, also very interesting.
If you want to get started on a very simple level, read Blackburn and Bos (2005), it's great stuff, and the de-facto introduction to Computational Semantics! I recently extended their system to cover the partition-theory of questions (question answering is a beast!), as proposed by Groenendijk and Stokhof (1982), but unfortunately, the theory has a complexity of O(n²) over the domain of individuals. While doing so, I found B&B's implementation to be a bit, erhm… hackish, at places. Still, it is going to really, really help you dive into computational semantics, and it is still a very impressive showcase of what can be done. Also, they deserve extra cool-points for implementing a grammar that is settled in Pulp Fiction (the movie).
And while I'm at it, pick up Prolog. A lot of research in computational semantics is based on Prolog. Learn Prolog Now! is a good intro. I can also recommend "The Art of Prolog" and Covington's "Prolog Programming in Depth" and "Natural Language Processing for Prolog Programmers", the former of which is available for free online.
Chomsky is totally the wrong source to look to for NLP (and he'd say as much himself, emphatically)--see: "Statistical Methods and Linguistics" by Abney.
Jurafsky and Martin, mentioned above, is a standard reference, but I myself prefer Manning and Schütze. If you're serious about NLP you'll probably want to read both. There are videos of one of Manning's courses available online.
If you get through Prolog until the DCG chapter in Learn Prolog Now! mentioned by Mr. Dimitrov above, you'll have a good beginning at getting some semantics into your system, since Prolog gives you a very simple way of maintaining a database of knowledge and belief, which can be updated through question-answering.
As regards the literature, I have one major recommendation for you: run out and buy Speech and Language Processing by Jurafsky & Martin. It is pretty much the book on NLP (the first chapter is available online); used in a frillion university courses but also very readable for the non-linguist and practically oriented, while at the same time going fairly deep into the linguistics problems. I really cannot recommend it enough. Chapters 17, 18 and 21 seem to be what you're looking for (14, 15 and 18 in the first edition); they show you simple lambda notation which translates pretty well to Prolog DCG's with features.
Oh, btw, on getting the masters in linguistics; if NL semantics is what you're into, I'd rather recommend taking all the AI-related courses you can find (although any courses on "plain" linguistic semantics, logic, logical semantics, DRT, LFG/HPSG/CCG, NL parsing, formal linguistic theory, etc. wouldn't hurt...)
Reading Chomsky's original literature is not really useful; as far as I know there are no current implementations that directly correspond to his theories, all the useful stuff of his is pretty much subsumed by other theories (and anyone who stays near linguists for any matter of time will absorb knowledge of Chomsky by osmosis).
I'd highly recommend playing around with the NLTK and reading the NLTK Book. The NLTK is very powerful and easy to get into.
You could try reading up a bit on phrase structured grammers, which is basically the mathematics behind much language processessing. It's actually not that heavy, being largely based on set and graph theory. I studied it many moons ago as part of a discrete math course, and I guess there are many good references available at this stage.
Edit:Not as much as I expected on google, although this one looks like a good learning source.
One of the early explorers into NLP is Noam Chomsky; he wrote small books on the subject in the 50s through the 70s. You may find that engaging reading.
Cycorp have a short description of how their Cyc knowledge base derives meaning from sentences.
By utilising a massive knowledge base of common facts, the system can determine the most logical parse of a sentence.
A simpler place to begin with the building blocks is the look at the documentation for a package that attempts to do it. I'd recommend the Python [Natural Language Toolkit (NLTK)1, particularly because of their well-written, free book, which is filled with examples. It won't get you all the way to what you want (which is an AI-hard problem), but it will give you a good footing. NLTK has parsers, chunkers, context-free grammars, and more.
This is really hard stuff. I'd start off by getting at least a Masters in Linguistics, and then work towards my PhD in computer science, concentrating on NLP.
The problem is that most of us don't have the understanding of what language is. And without that understanding, it's bloody tough to implement a solution.
Other comments give some readings, which are probably fine if you want to get started playing around with a small subset of the problem, but in order to come up with a really robust solution, then there are no shortcuts. You need the academic background in both disciplines.
A very enjoyable readable introduction is The Language Instinct by Steven Pinker. It goes into the Chomsky stuff and also tells interesting stories from the evolutionary biology angle. Might be worth starting with something like that before diving into Chomsky's papers and related work, if you're new to the subject.

Resources